Archive for the ‘Tips and Tricks’ Category
December 13, 2009
We all need passwords all the time… Yet, according to recent studies, between 30% and 60% of people use the same password for all their accounts! See [1] [2] and more…
For those of us that do need (or better yet, do want) a good password, unique to each application – system account, encrypted partition, ssh pubkeys, server administration, etc. etc. – we need a good generator; don’t forget that simple random typing also decreases entropy!
Here are 2 simple password generators I use (easy to carry around on your flash); both of them use what is readily available on most *nix systems.
Feel free to post your favourite one in comment, so that we all can learn and prosper!
Read the rest of this entry ?
Posted in Computers, Linux, Security, Tips and Tricks | Tagged password generator | Leave a Comment »
December 11, 2009
Mainly for my reference, here’s a small list of most useful key short-cuts for the GNU screen – GNU version of BSD’s tmux terminal multiplexer.
The main purpose of GNU screen is to allow you to run several terminals “in one”, without the need to log into remote (or local, if needed) system.
This is done by spawning virtual terminals (screens or windows) inside the terminal.
Another, maybe even more useful feature of screen is, that it is persistent. You can easily detach from the session, and log out of the remote server, while any programs you left running in the screen session will stay alive, in a similar way they would with nohup, while having the interactiveness of terminal still available. Afterwards, you can resume previous session once you log back in.
Read the rest of this entry ?
Posted in Computers, Linux, Tips and Tricks, Tutorials | Tagged GNU, screen | Leave a Comment »
June 26, 2009
conky is one hack of a great monitoring tools, but it misses the use of S.M.A.R.T. technology (as far as I know) to monitor hard-disk health, specifically use of smartmontools.
I present here quite dirty, but simple and easily extensible, way to include information from smartctl in conky output.
Read the rest of this entry ?
Posted in Computers, Linux, Tips and Tricks, Tutorials | Tagged conky, cron, S.M.A.R.T., smartctl, smartd, smartmontools | Leave a Comment »
June 24, 2009
genmake, the Not so Simple Makefile Generator Bash Script, is now hosted on Google Code (for older version, check this post).
The version 2 now supports:
- executables, static libraries, and dynamic link libraries, based on the output file name format,
- automatic increment of build number on each build (the header file including the version and build number is automatically generated; requires Awk),
- several build targets – debug, debug profile, release, release profile,
- easily specifying additional flags passed to compiler,
- passing list of link libraries used for build,
- selectively excluding files from build, and more…
Happy coding!
Posted in C/C++, Computers, Linux, Programming, Tips and Tricks | Tagged Bash, Generator, Make, Makefile | Leave a Comment »
June 19, 2009
This trick works with most IDE’s that use pre-build step, but easiest I guess is to use it in a Makefile. Feel free to modify the “script” in any way it suites your purposes.
Suppose you have a build number defined as #define BuildNum 1 in BuildNum.h header.
All you have to do is add the following command in your make all section in Makefile ahead of other dependencies (it’s one line, broken here for visibility):
awk '$2 !~ /BuildNum/ {print} $2 ~ /BuildNum/ {print "#define BuildNum "$3+1}'\
BuildNum.h > BuildNum.h~; mv BuildNum.h~ BuildNum.h
Yes, it’s a clumsy solution, but it does the work just fine…
Sure, you can catch the lines in array, and afterwards print them one by one back to file, etc. … but it’s just not at all pretty bash script (enhancements and suggestions welcome!).
Notice that the command is pretty much dependent on the format of the line the BuildNum is defined on, and that “BuildNum” should not appear anywhere else as a second word on the line!
Posted in C/C++, Computers, Linux, Programming, Tips and Tricks | Tagged awk, build nuber, Make, Makefile | Leave a Comment »
June 9, 2009
socat (SOcket CAT) – multipurpose relay – is a command line based utility that establishes two bidirectional byte streams and transfers data between them.
socat is #4 on the Top 100 Network Security Tools list, available in most distro repositories (on Debian/Ubuntu sudo apt-get install socat does the trick), really light on resources, and very efficient.
Sounds simple, does wonders!
Sidenote: socat is actually #71 on the mentioned list, but since socat is a much enhanced version of netcat, which is #4, it seems to me logical to count socat as #4 also.
One of the wonders you can do is creating pairs of “virtual” ports/interfaces/sockets etc., even hybrid pairs like port-socket, etc., where one (or both) ends of the pair can also be real objects. See socat man page for more details.
Read the rest of this entry ?
Posted in Computers, Linux, Programming, Tips and Tricks, Tutorials | Tagged socat, virtual devices | Leave a Comment »
February 17, 2009
If you’re getting the “mod_mime_magic: invalid type 0 in mconvert()” error in your error log of Apache (or any other http server), it’s most probably due to fault in mime-magic’s configuration.
Read the rest of this entry ?
Posted in Computers, Linux, Programming, Tips and Tricks, Troubleshooting, Windows | Tagged Apache, mime-magic | 2 Comments »