Mostly Unixish Standalone, single-file, editable Python scripts WITH DEPENDENCIES How badly I wanted something like that? The problem: Python for scripting Beside programming and data science, I find Python to be a very useful glue language; I think it's
Mostly Unixish Misaligned Expectations: investigating the expectations gap As some of my followers already know, I'm enrolled in the great Master's program at Georgia Tech, the OMSCS. As a part of my studies, I'm doing some research to
Mostly Unixish SCP taming: stop local silliness Every day now and then, I get an scp command wrong. Scp is designed after commands like rcp and works totally fine for local-to-local file copy. While this can (or could) be useful in some contexts, It's not what I like to do these
Ollivander Command line data crunching with Python Every time I'm doing some data crunching on the command line, I find myself juggling between sed, awk, sort, uniq, etc. While I like the UNIX way of having one
Mostly Unixish Git: automatically set and use multiple commit identities Sure, git is great. Sure it is possible to use multiple commit identities in git - just set local per-repo variables. If it weren't for the fact that chances of
Mostly Unixish badblocks: test your mass storage! Are you unsure whether your mass storage works properly? Do you suspect it's faulty somewhere? Verify it with a nifty tool, included in most Linux distros and in macOS if you install the ext2fs tools: sudo badblocks -swv -t random -b 4096 -c 2048
Mostly Unixish Automated cleanup of Docker leavings As much as I like Docker, one thing it doesn't do well: cleanup whatever is left on my hard drive after running it for a while. There're generally two kinds
Mostly Unixish Python requests SSL and InsecurePlatformWarning Every now and then, when using Python 2.7 < 2.7.9 and trying to access SSL resources, especially through the requests toolkit, which seems to trigger the issue frequently - but I've seen it on some combinations of pip inside virtualenv as
Mostly Unixish chmod and the capital X This is one very, very, very interesting piece of ancient wisdom. Suppose you need to change permissions for some directories. Maybe the permissions are too strict, e.g. something like 700 for directories and 600 for files, and you need to give access to
Mostly Unixish Kill Me Softly: killing a process The Right Way I was tired of repeating the same old pattern. Send a kill signal. Check with pgrep. Did the process exit? Send a kill -9. Now all my knowledge has been permanently dumped here: Kill Me Softly on GitHub If you want to kill a
Mostly Unixish Unfreezing your desktop: when Compiz goes wrong A desktop freeze is something that's not so rare nowadays - that's not good, but we shouldn't get desperate about that. I like Compiz with Unity Desktop on my Ubuntu Trusty very much; I feel it's a step forward compared to traditional desktops. The
Mostly Unixish Don't give a shell to system users - use su I seem very ancientwisdom-oriented these days. Sometimes you've got a system user on your linux server that's used to run a specific service; it's a good practice to employ those users to achieve privilege separation, since it limits the impact of many security breaches.
Mostly Unixish SSH hostnames configuration and shortcuts This is another old trick, but I like to tell the world about such amenities. I often find people writing command lines such as: ssh arcane-system-user@someextremelylong.andimpossibiletotype.anderrorprone.hostname.com or, worse ssh idliketorememberwhichuser@10.20.30.40 or maybe it was ssh
Mostly Unixish I wish sudo would ask for my password less often This is a very old trick, but I find many people doesn't know about it yet. If you're using sudo (and you definitely should), one minor complaint is that you need to re-enter your password quite often. One common pseudo-solution is to completely disable
Mostly Unixish Ubuntu: faster release upgrade It might be high time to update to the latest Ubuntu 14.04. I think that the upgrade process that is provided by Canonical is slightly underoptimal: if you're using a local mirror which can provide a very fast download of all packages, they'll
Mostly Unixish Keep your tomcat instance up-to-date, and keep apps and configuration tidy. UPDATED: 26th January 2015, with Tomcat 8 support. Today I'm gonna share something that I figured out some times ago: how do I keep my tomcat installation up to date on my servers? Of course I'm not willing to automatically switch majors, but I'd
Mostly Unixish Puppet Http Source for files Sometimes you would like to use an http URL as the source file for puppet; while it's being discussed since long, no implementation has been created so far. Of course it would be better to periodically download the file from its http source to
Mostly Unixish Quick log for bash scripts, with line limit Sometimes you need to write a quick shell script; many a time, you need to put it on a server, and launch it every now and then, or run it in a cron job. That script may end up doing something important and/or
Mostly Unixish apt-get update: fixing 'package index files are corrupted' Sometimes when performing your daily apt-get update, you'll experience messages like E: The package lists or status file could not be parsed or opened. or The package index files are corrupted Such messages usually don't go away for quite a long time, and may
Mostly Unixish Wmctrl: gather and focus your chosen window by hotkey I find it extremely handy to be able to recall my windows by just using the keyboard. It's pretty easy to do in Linux, just use: wmctrl -x -R <WM_CLASS> you can find the WM_CLASS of any window using this
Mostly Unixish ssh-copy-id with nonstandard sshd port UPDATE: modern ssh-copy-id often support a -p parameter for the port. So this trick is unnecessary and won't probably work. ssh-copy-id is a cool script which is usually distributed along openssh client nowadays; it performs an automatic install of your local public SSH key
Mostly Unixish ssh client: stopping key verification complaints inside your own private network If you develop enough software, most probably you'll have a test/development network at your service. In such networks, which are usually handled through a virtualization infrastructure, machines come and go very quickly. But ssh clients are usually unhappy about that: alan@melquiades:/etc/
Mostly Unixish Thunderbird temporary directory Whenever you use Thunderbird on Linux you may encounter one annoying behaviour. If you open a message which is got an attachment - you just need to open the message, not to save the attachment! - Thunderbird will place such attachment in our temporary
Mostly Unixish Disown is your friend Bash builtin disown is a not-so-well known [job control command] http://www.gnu.org/software/bash/manual/html_node/Job-Control-Builtins.html), and yet it's an extremely useful one. So what? You've started a remote ssh session, launched some command which is taking very, very
Mostly Unixish Purging outdated kernels on systems with unattended-upgrades Whenever I install a production system/server I tend to enable full automatic updating, because it's usually better that something breaks because of a failed update rather than leaving a production machine unpatched; and if you pick a rather stable distribution (Centos or Ubuntu