Skip to content

Instantly share code, notes, and snippets.

@smblott-github
smblott-github / dwm.c
Created Dec 26, 2018
<alt-Tab> for dwm
View dwm.c
/* this implements <alt-Tab> for dwm, put it in config.h */
static int alt_tab_count = 0;
/* focus and restack a client */
static void focus_restack(Client *c)
{ if (c) { focus(c); restack(selmon); } }
static void start_alt_tab(const Arg *arg)
{ alt_tab_count = 0; }
@smblott-github
smblott-github / rc
Last active Dec 26, 2018
Maintain the correct SSH agent config when using tmux remotely (after detach, reattach)
View rc
#!/bin/sh
# This goes in ~/.ssh/rc.
# It adds a symlink to the new $SSH_AUTH_SOCK under ~/.ssh/ssh-auth-socks/.
# The symlink is named after the current /dev/pts entry, so that we can find the correct link/agent to use later.
if [ -n "$SSH_TTY" ] && [ -n "$SSH_AUTH_SOCK" ]
then
mkdir -p $HOME/.ssh/ssh-auth-socks
ln -sf $SSH_AUTH_SOCK $HOME/.ssh/ssh-auth-socks/${SSH_TTY##*/}
View sum-digits.py
#!/usr/bin/env python
# Find all nine-digit numbers whose digits are a permutation of the digits 1 to
# 9 and such that, taken independently:
#
# - the first digit is divisible by 1
# - the first two digits are divisible by 2
# - the first three digits are divisible by 3
# - and so on.
#
@smblott-github
smblott-github / _drive
Created Nov 5, 2015
Rudimentary zsh completion for odeke-em/drive (a Google Drive utility)
View _drive
#compdef drive drive-google
local cmnd desc
if [[ $CURRENT == 2 ]]
then
local -a options
drive |
grep '^ [a-z]' |
while read cmnd desc
do
@smblott-github
smblott-github / launch-vim-in-pantheon-terminal
Created Jun 16, 2015
Pantheon-terminal for Text-Aid-Too
View launch-vim-in-pantheon-terminal
#!/bin/sh
exec pantheon-terminal -e "vim $@"
# Save this in a file "FILENAME", then ...
# export TEXT_AID_TOO_EDITOR="exec sh /full/path/to/FILENAME"
#
# For example,
# export TEXT_AID_TOO_EDITOR="exec sh /home/blott/tmp/launch-vim-in-pantheon-terminal"
@smblott-github
smblott-github / _insync-headless
Last active Mar 16, 2018
Simple zsh completion for insync, insync-headless and insync-portable. Grab this, name it "_insync-headless" and put it in some suitable location for zsh completion functions. And good luck. Zsh completion is a mystery to me.
View _insync-headless
#compdef insync-headless insync-portable insync
if [[ $CURRENT == 2 ]]
then
_values 'commands' \
'accept_all_new_shares[Accept all new shares file to given account]' \
'accept_share[Accept shared file to given account]' \
'add_account[Add account to Insync]' \
'force_sync[Force sync item]' \
'get_account_information[Show information for connected acounts]' \