Managing Python daemon processes with Bash
Usually if you want to kill some processes they have to have unique names or you have to know their process IDs. Lately I’ve had a group of python daemon scripts that need to be restarted...
View ArticleBash Snippet: Monitor Process Memory Usage
Here’s a neat Bash one-liner: ps aux | grep -E '[l]ighttpd|[m]ain.py' This returns your process list with memory columns (RSS & VSZ) filtered by multiple names. Now you could make a little script...
View ArticleBash Snippet: Move list of files from stdin
Tonight I had a list of filenames copied on my local computer and wanted to move them in an ssh session. Here’s how I did it: cat | while read line; do mv "$line" destination_directory; done After...
View ArticleBash snippet: Initialize a bunch of files with dummy text
Check it: for i in test-{0..10}; do echo "dummy data" > $i; done Neat!
View ArticleHow to install Pd-extended on Ubuntu 10.04 via terminal
Today I installed Pd-extended on my new Linode VPS (Virtual Private Server) for my PuréeData project. Since it’s a VPS, I only have ssh access. Here’s how to do it: sudo vim /etc/apt/sources.list hit...
View ArticleStreaming MPD to Icecast as mp3—and more!
Since it’s non-obvious, here’s what I had to do to stream MPD to Icecast using mp3. I had been using ogg and it worked, but the latency was over 10 seconds!! That means every time I changed a song or...
View ArticleBash snippet: Process Search & Destroy
Occasionally on my server I’ll get dead processes that fit a specific command pattern, and I need to kill them. However, I don’t want to killall, as other processes of the same program are still...
View ArticleBash snippet: Remove text from filenames
Today I had a directory full of mp3 files for a Flash game that each had the text “woman01″ in them. Since I wanted to just keep the rest of the filename, I put together this Bash one-liner: for f in...
View ArticleTutorial: How to use your Raspberry Pi like an Arduino
Finally got to experiment with the Raspberry Pi’s GPIO (General Purpose Input/Output) pins. I tried three methods: Python, Bash and C, and will describe each. But first, here’s some setup...
View ArticleBatch convert files to PDFs in OSX Mountain Lion
Today I needed to convert a bunch of RTF files (I know, what?) to PDFs. After stumbling through a bunch of dead ends, I realized this—like most things—could be done incredibly easily in Bash:...
View Article