I would like to generate a streamable histgram that runs in bash. Given an input stream of integers (from stdin or a file), I would like to transform each integer to that respective number of “#” up to the length of the terminal window; in other words, 5 would become “#####”, and so on. You […]
Author: timwarnock
xmouse
I would like to remotely control my Linux desktop via an ssh connection (connected through my phone). Fortunately, we can use xdotool. I created a simple command-interpreter that maps keys to xdotool. I used standard video game controls (wasd) for large mouse movements (100px), with smaller movements available (ijkl 10px). It can toggle between mouse […]
VLC remote control
Recently I was using VLC to listen to music, as I often do, and I wanted to pause without getting out of bed. Lazy? Yes! I learned that VLC includes a slew of remote control interfaces, including a built-in web interface as well as a raw socket interface. In VLC Advanced Preferences, go to “Interface”, […]
datsize, simple command line row and column count
Lately I’ve been working with lots of data files with fixed rows and columns, and have been finding myself doing the following a lot: Getting the row count of a file, twarnock@laptop:/var/data/ctm :) wc -l lda_out/final.gamma 3183 lda_out/final.gamma twarnock@laptop:/var/data/ctm :) wc -l lda_out/final.beta 200 lda_out/final.beta And getting the column count of the same files, twarnock@laptop:/var/data/ctm […]
Getting the most out of your ssh config
I typically find myself with voluminous bashrc files filled with aliases and functions for connecting to specific hosts via ssh. I would like an easier way to manage the various ssh hosts, ports, and keys. I typically maintain an ssh-agent across multiple hosts, as well as various tunnels; reverse tunnels, and chained tunnels — but […]
git, obliterate specific commits
I would like to obliterate a series of git commits between two points, we’ll call these the START and END commits. First, determine the SHA1 for the two commits, we’ll be forcefully deleting everything in between and preserving the END exactly as it is. Detach Head Detach head and move to END commit, git checkout […]
vim: Visual mode
I have been using vim for years and am consistently surprised at the amazing things it can do. Vim has been around longer than I have been writing code, and its predecessor (Vi) is as old as I am. Somehow through the years this editor has gained and continues to gain popularity. Originally, my interest […]
vim: tags and tabs
Previously, I discussed using vim and screen with automagic titles. The great part about working with vim and screen is that I can work from anywhere with minimal setup, and when working remotely I can pick up the cursor exactly where I left it — I never have to worry about a remote terminal disconnecting. […]
vim and screen, automagic titles
Previously, I discussed using multiuser screen so that I could concurrently access a shared screen session across multiple remote hosts (from work, from home, from my phone, etc). I would like to augment screen such that the titles would always tell me what directory I’m currently in, as well as what program is running (if […]
node.js redirect with query string
Previously, I discussed javascript appending to query string, where we serialized an associative array to a query string. I would now like to leverage this technique within node.js as a redirect service. Specifically, I am using express to make a web app in node.js and the app includes a redirect service, e.g., var app = […]
javascript appending to query string
I would like to append an associative array to a URL’s query string. For whatever reason, there is no native javascript method to accomplish this task. This needs to be done manually or using a common web framework such as jQuery. The first step is to serialize the associative array into a query string, native […]
multiuser screen
Previously, I discussed using GNU screen as a window manager. I would like to access my screen session concurrently from multiple hosts (say, at work, at home, and even remotely on my phone). I would also like to define default screens specific to one host. Default screens can be configured easily in the .screenrc in […]
scripting Photoshop for stop motion
I would like a simple and quick way to save a copy of an image in Photoshop, with an auto-incrementing filename. Ideally, a single button to capture a frame in a stop motion animation. In other words, I would like to save a copy of the working image as a JPEG without any interactive prompts […]
locking and concurrency in python, part 2
Previously, I created a “MultiLock” class for managing locks and lockgroups across a shared file system. Now I want to create a simple command-line utility that uses this functionality. To start, we can create a simple runone() function that leverages MutliLock, e.g., def _runone(func, lockname, lockgroup, basedir, *args, **kwargs): ”’ run one, AND ONLY ONE, […]
locking and concurrency in python, part 1
I would like to do file-locking concurrency control in python. Additionally, I would like to provide a “run-once-and-only-once” functionality on a shared cluster; in other words, I have multiple batch jobs to run over a shared compute cluster and I want a simple way to provide fault tolerance for parallel jobs. The batch jobs should […]