Skip to content

Instantly share code, notes, and snippets.

Avatar
🌞
DO YOU EVEN ADHERE BRO

Naftuli Kay naftulikay

🌞
DO YOU EVEN ADHERE BRO
View GitHub Profile
@naftulikay
naftulikay / gottasignemall.sh
Last active Aug 29, 2015
Create Signatures and Checksums for Multiple Files at Once
View gottasignemall.sh
#!/bin/bash
# needs: apt-get install gnupg parallel
# for mybackup.tar.gz.aa, mybackup.tar.gz.ab, etc.
find . -maxdepth 1 -type f -iname "mybackup.tar.gz.??" | parallel --gnu \
-j 8 --workdir "$PWD" '
gpg --armor --detach-sig "{}" ;
echo -n "$(shasum "{}" | cut -b 1-40)" > "{}.sha" ;
echo -n "$(md5sum "{}" | cut -b 1-32)" > "{}.md5" ;
@naftulikay
naftulikay / bitly_shortener.py
Created May 13, 2014
AutoKey Bit.ly Link Shortener
View bitly_shortener.py
# Bit.ly URL Shortener for AutoKey
#
# On Ubuntu, you must run:
#
# sudo apt-get install xclip python-pip
#
# and
#
# sudo pip install requests
@naftulikay
naftulikay / generate_jira_label.sh
Created May 13, 2014
Generate JIRA Ticket Labels
View generate_jira_label.sh
#!/bin/bash
function generate-jira-label() {
# Generates a 256 square label, given a JIRA name matching the following pattern:
# (\w+)-(\d+)
# ie: AA-1234, JV-511
if [ -z "$1" ]; then
echo "Please provide a JIRA number like AA-1234 as the first argument." >&2
exit 1
@naftulikay
naftulikay / genkeys.sh
Created Jun 3, 2014
PKCS#8 Private Key Encryption Demo
View genkeys.sh
#!/bin/bash
# Generates 2048 and 4096 bit SSH private keys, then encrypts them in the following
# variations:
#
# Ciphers:
# * aes-192-cbc
# * aes-256-cbc
#
# PBKDF2 Iterations:
@naftulikay
naftulikay / multiline-variables.sh
Last active Aug 29, 2015
Multiline Embedded Bash Variables
View multiline-variables.sh
#!/bin/bash
# This is terribly annoying to remember, but here's how you do multiline
# variables in Bash.
read -d '' suchvariable <<EOF
usage: do this thing
preserves linebreak
wow such things
@naftulikay
naftulikay / img-clean
Last active Aug 29, 2015
Image Metadata Cleaner
View img-clean
#!/bin/bash
# img-clean: remove ALL metadata from images
# requires ImageMagick
# A POSIX variable
OPTIND=1 # is reset in case getopts was already run
verbose=0
backup=0
@naftulikay
naftulikay / obliterate.sh
Created Jul 10, 2014
Android Secure Shred
View obliterate.sh
#!/sbin/sh
# To be used with extreme caution.
# This script will utterly and totally obliterate any block device
# you pass to it. It was designed for use on Android for secure
# wiping of devices, but could probably be used otherwise.
# DO NOT USE THIS UNLESS YOU ARE ABSOLUTELY SURE OF WHAT YOU'RE DOING
help_text="usage: obliterate [partition]"
View gist:3b1a47690ab0775bfef9
### Keybase proof
I hereby claim:
* I am rfkrocktk on github.
* I am rfkrocktk (https://keybase.io/rfkrocktk) on keybase.
* I have a public key whose fingerprint is 0E26 BDF1 BD1C 4A16 9571 21A8 8938 1D75 6569 758F
To claim this, I am signing this object:
View screensaver-dbu-listener.py
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from dbus.mainloop.glib import DBusGMainLoop
import dbus
import gobject
import logging
logging.basicConfig(
@naftulikay
naftulikay / .bashrc
Created Sep 2, 2015
GPG agent with SSH support and remote passthrough.
View .bashrc
#!/bin/bash
# ... normal .bashrc stuff
# if our gpg agent environment file exists _and_ we're not over SSH
if [[ -f "$HOME/.gpg-agent-info" && -z "$SSH_CLIENT" ]]; then
# load environment variables to use local gpg agent for gpg and SSH
source "$HOME/.gpg-agent-info"
export GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID
fi
You can’t perform that action at this time.