I don’t know about the other people but to me the scariest UNIX command is by far sed. Today I found myself in a situation where I found no other way to solve my problem but to use sed… and it worked… and was not all that scary 🙂 I needed to replace a bunch […]
Author: ench0
How to map enum to strings in C
How can we map the enum values to strings in the C programing language? Often times you need to display a C enum as a string, most often when debugging or handling error conditions. Typical techiques involve usually: a) defining an array of strings (the strings being the enum names of course, and the string […]
Makefile variables ($@, $< ...)
Ever wondered what the funny-looking vars in the GNU Makefiles are? These two are the most common ones:  $@ and @< there are some other are special vars as well. Here’s what these two mean, and you can look up the rest on the GNU Makefile “Automatic Variables” help page: $@   -is the name of the target currently […]
Emacs wrap lines (disable/enable with toggle-truncate-lines)
Wrapping lines in emacs can be a real pain (fe.g. or programmers) or exactly what you want, for example if you’re writing the text of an email. At any rate it’s nice to know how to turn line wrap on and off in emacs – if anything every now and then you’d accidentally press the […]
Setting up a ‘LAMP’ server (Linux-Apache-mySQL-PHP)
… copied as-is from : http://fedorasolved.org/server-solutions/lamp-stack Very useful info, everything works like a charm (I tried on FC15) so I am replicating this here in case that page ever gets archived, goes offline, etc. I will see if I can add some more info about setting phpMyAdmin here as well. Doing the work The best […]
git clone gives warning: “remote HEAD refers to nonexistent ref, unable to checkout.”
This warning: “remote HEAD refers to nonexistent ref, unable to checkout.” happened to me today and since it was an odd enough warning (I’ve never seen it before in all my years of work with git) I thought it’s worth describing the situation here and how I solved it. I cloned a remote git repository […]
Converting defines to strings in precompiler directives
Often times it is useful to construct a string visible to the pre-compiler and assemble it from one more more other values, defined by means of a #define dierctive. Here’s some example code (this is some custom environemnt config for U-Boot for a STM-based device I work with): #if defined( DEVELOPER_ALAN ) #define CONFIG_ETHADDR 00:23:b0:00:00:00 […]
Bash quick cheatsheat (‘if’ checks and other useful commands)
Creating this post to dump here various bash shell and script commands, tips and tricks which I found useful in my everyday work. Will update it with new info continually… ——— Check in bash if a file exists or not and do something in each case: if [ -f $FILE ]; then echo “File $FILE […]
Lost window decorations in XFCE!
Yep, that happens from time to time – you start XFCE and you notice that all the window decorations are lost and your windows look like this: Luckily fixing this is pretty easy. To get back your window decorations simply delete all the files in ~/.cache/sessions! 🙂 There is also directories in there – do […]
A nice linux mp3 editing tool?
Ahem… well… there ain’t one. Sorryh folks. Well, at least I could not find any. Setting up audacity with a ton of plugins to make it export WAV files which you can then edit and then re-encode with lame back into MP3 is not my idea of an easy-to-use editing tool… So… how can we […]