commit 57a278fba5537e9f4ddcd896f058553b45af03fa
parent f475d88c61d1b350a2ad4b18ce06787eb858120c
Author: rsiddharth <rsiddharth@ninthfloor.org>
Date: Sat, 27 Feb 2016 17:54:44 -0500
Added .bin/
Bunch o' scripts.
Diffstat:
14 files changed, 492 insertions(+), 0 deletions(-)
diff --git a/.bin/annex-chum b/.bin/annex-chum
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see COPYING). If not, see
+# <http://www.gnu.org/licenses/>.
+
+if [ -d $CHUM_ANNEX_PATH ]; then
+ echo 'annexing...'
+ cd $CHUM_ANNEX_PATH
+ git annex sync
+ git annex get docs/
+ echo 'finished annexing.'
+else
+ echo '$CHUM_ANNEX_PATH not found.'
+ exit 1
+fi
diff --git a/.bin/annex-jarl b/.bin/annex-jarl
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see COPYING). If not, see
+# <http://www.gnu.org/licenses/>.
+
+if [ -d $JARL_ANNEX_PATH ]; then
+ echo 'annexing...'
+ cd $JARL_ANNEX_PATH
+ git annex sync
+ git annex get --all
+ echo 'finished annexing.'
+else
+ echo '$JARL_ANNEX_PATH not found.'
+ exit 1
+fi
diff --git a/.bin/chrm b/.bin/chrm
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+chromium --incognito
diff --git a/.bin/chrmt b/.bin/chrmt
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+# requires tor ($ aptitude install tor)
+chromium --incognito --proxy-server=socks://localhost:9050
diff --git a/.bin/ec b/.bin/ec
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+emacsclient -c
diff --git a/.bin/fdump b/.bin/fdump
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2015 rsiddharth <s@ricketyspace.net>
+#
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+import shlex
+
+from argparse import ArgumentParser
+from os import environ as env
+from subprocess import call, PIPE
+
+
+DEST = env.get('FDUMP_DEST')
+"""Destination to dump file(s) to. """
+
+
+IDENTITY_FILE = env.get('FDUMP_ID')
+"""Path to SSH private key to ``scp`` :data:`DEST`.
+
+In SSH lingo the private key is called the 'identity file'.
+"""
+
+
+SCP = 'scp'
+"""`scp` command."""
+
+
+SCP_OPTS = '-i %s' % IDENTITY_FILE
+"""`scp` options."""
+
+
+cat = ' '.join
+
+
+def make_cmd(srcs):
+ """Make command to do the dump.
+ """
+ return shlex.split('%s %s %s %s' % (SCP, SCP_OPTS, cat(srcs),
+ DEST))
+
+
+def dump(srcs):
+ """Dump `srcs` to DEST using ``scp``."""
+ cmd = make_cmd(srcs)
+
+ if call(cmd) == 0:
+ print 'dumped.'
+ else:
+ print 'failed to dump.'
+
+
+if __name__ == '__main__':
+ parser = ArgumentParser()
+ parser.add_argument('srcs',
+ nargs='+')
+ args = parser.parse_args()
+ dump(args.srcs)
diff --git a/.bin/gnupg-backup b/.bin/gnupg-backup
@@ -0,0 +1,140 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2015 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+import os
+import shlex
+
+from argparse import ArgumentParser
+from hashlib import sha256
+from os import path
+from shutil import rmtree
+from subprocess import call
+
+GPG = 'gpg'
+
+OPT_EXPORT = '-a --export'
+OPT_EXPORT_SEC = '-a --export-secret-keys'
+OPT_EXPORT_TRUST = '--export-ownertrust'
+
+OPT_SYM_ENCRYPT = "--symmetric"
+OPT_GPG_OUT = "--output"
+
+TAR = 'tar'
+OPT_TAR_CRT = 'cvf'
+OUT_TAR_SUFFIX = '.tar.gz'
+
+DIR_PREFIX = 'gnupg-'
+
+OUT_PUB = 'pub.key'
+OUT_SEC = 'sec.key'
+OUT_TRUST = 'trust.gpg'
+
+def tar_it(f):
+ """
+ Creates a compressed tar ball of `f` at path.dirname(directory).
+
+ Returns the path of the compress tar ball.
+ """
+ tar_ball = path.join(path.dirname(f),
+ "%s%s" % (path.basename(f),
+ OUT_TAR_SUFFIX))
+
+ print "creating tar ball %s..." % tar_ball
+ call(shlex.split("%s %s %s %s" % (TAR, OPT_TAR_CRT, tar_ball,
+ f)))
+
+ return tar_ball
+
+
+def encrypt_it(f):
+ """
+ Encrypts file `f`.
+ """
+ blob = sha256(f).hexdigest()
+ blob_path = path.join(path.dirname(f), blob)
+
+ print "blobbing %s to %s" % (f, blob_path)
+ call(shlex.split("%s %s %s %s %s" % (GPG, OPT_GPG_OUT, blob_path,
+ OPT_SYM_ENCRYPT, f)))
+
+
+def gnupg_export(email, directory):
+ """Export gnupg data connect with `email' to `directory`.
+
+ This function will create directory call `gnupg-email` inside
+ `directory` and export write gnupg data connected with `email` to
+ 3 seperate files under `gnupg-email`
+ """
+
+ # First make the `gnupg-email` directory.
+ try:
+ export_dir = path.join(directory,
+ "%s%s" % (DIR_PREFIX, email))
+ os.mkdir(export_dir)
+ except OSError:
+ print "Looks like %s already exists" % export_dir
+
+ # Export public key.
+ pub_key = path.join(export_dir, OUT_PUB)
+
+ print "writing public key to %s" % pub_key
+ with open(pub_key, 'w') as out:
+ call(shlex.split("%s %s %s" % (GPG, OPT_EXPORT, email)),
+ stdout=out)
+
+ # Export secret key.
+ sec_key = path.join(export_dir, OUT_SEC)
+
+ print "writing secret key to %s" % sec_key
+ with open(sec_key, 'w') as out:
+ call(shlex.split("%s %s %s" % (GPG, OPT_EXPORT_SEC, email)),
+ stdout=out)
+
+ # Export trust.
+ trust = path.join(export_dir, OUT_TRUST)
+
+ print "writing owner trust to %s" % trust
+ with open(trust, 'w') as out:
+ call(shlex.split("%s %s" % (GPG, OPT_EXPORT_TRUST)),
+ stdout=out)
+
+ # Create a tar ball of the export_dir.
+ tar_ball = tar_it(export_dir)
+
+ # Encrypt the tar ball.
+ encrypt_it(tar_ball)
+
+ # Clean up.
+ rmtree(export_dir)
+ os.remove(tar_ball)
+
+
+if __name__ == "__main__":
+ parser = ArgumentParser()
+ group = parser.add_argument_group('group')
+ group.add_argument('email',
+ help="email address to export")
+ group.add_argument('directory',
+ help="directory to export to")
+ args = parser.parse_args()
+
+ directory = path.expanduser(args.directory)
+ if path.exists(directory):
+ gnupg_export(args.email, directory)
+ else:
+ print "%s does not exist. Exiting..." % (directory)
diff --git a/.bin/i3-startup-always b/.bin/i3-startup-always
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see COPYING). If not, see
+# <http://www.gnu.org/licenses/>.
+
+# set background
+xsetroot -solid "#002b36"
+
+# setup keyboard
+skb
+
+# setup urxvt
+xrdb -merge $HOME/.Xresources.d/Xresources
diff --git a/.bin/iwt b/.bin/iwt
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+iceweasel -new-tab
diff --git a/.bin/node b/.bin/node
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+/usr/bin/nodejs "$@"
diff --git a/.bin/rsd_dmenu b/.bin/rsd_dmenu
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+dmenu_run -fn terminus -nb '#002b36' -sb '#839496' -sf '#002b36'
diff --git a/.bin/rsync-bu-chum b/.bin/rsync-bu-chum
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see COPYING). If not, see
+# <http://www.gnu.org/licenses/>.
+
+if [ -d $CHUM_BACKUP_PATH ]; then
+ echo "rsyncing..."
+ rsync -ravz --delete-excluded --files-from=$CHUM_FILTER $HOME $CHUM_BACKUP_PATH
+ echo "finished rsyncing..."
+else
+ echo "$CHUM_BACKUP_PATH not found"
+ exit 1
+fi
+
diff --git a/.bin/rsync-bu-jarl b/.bin/rsync-bu-jarl
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see COPYING). If not, see
+# <http://www.gnu.org/licenses/>.
+
+if [ -d $JARL_BACKUP_PATH ]; then
+ echo 'rsyncing...'
+ rsync -ravz --delete-excluded --files-from=$JARL_FILTER $HOME $JARL_BACKUP_PATH
+ echo 'finished rsyncing.'
+else
+ echo '$JARL_BACKUP_PATH not found.'
+ exit 1
+fi
diff --git a/.bin/skb b/.bin/skb
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 rsiddharth <s@ricketyspace.net>
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see COPYING). If not, see
+# <http://www.gnu.org/licenses/>.
+
+# skb -> Setup KeyBoard
+
+## set keyboard delay and repeat rate
+xset r rate 200 35
+
+## set keyboard layout and switch caps to ctrl
+setxkbmap -layout dvorak -option ctrl:nocaps
+
+## remap keys
+xmodmap -e 'keycode 121=F1'
+xmodmap -e 'keycode 122=F2'
+xmodmap -e 'keycode 123=F3'
+xmodmap -e 'keycode 233=F12'