Skip to content

Instantly share code, notes, and snippets.

View naftulikay's full-sized avatar
🌞

Naftuli Kay naftulikay

🌞
View GitHub Profile
@naftulikay
naftulikay / makeqrs.py
Created April 30, 2014 05:02
Create QR Codes from a Google Authenticator SQLite Database
#!/usr/bin/env python2.7
import argparse
import os
import qrcode
import qrcode.image.pil
import sqlite3
import sys
import urllib
@naftulikay
naftulikay / s3-cloudfront-invalidation.sh
Last active November 7, 2022 21:44
Sync a directory to S3 and invalidate the CloudFront cache for changed resources.
#!/bin/bash
# output format is like this:
# upload: index.html to s3://$BUCKET/index.html
#
# so we grab the second item which is the file path and pass that via xargs to the
# cloudfront invalidation command
aws s3 sync --sse AES256 s3://$BUCKET/ site/ | awk '{print $2;}' | \
xargs aws cloudfront create-invalidation --distribution-id $CF_DISTRO_ID --paths
@naftulikay
naftulikay / git-branch-clean
Created September 30, 2016 23:51
Usage: `git branch-clean`
#!/bin/bash
# Usage: git branch-clean
#
# Removes all branches which have been successfully merged safely.
# Uses -d instead of -D to ensure only merged branches will be
# deleted.
#
# Install this script on your PATH somewhere.
set -ex
@naftulikay
naftulikay / generate-shadow-pass.py
Last active December 10, 2021 16:46
Generate an /etc/shadow compatible passphrase.
#!/usr/bin/env python3
from crypt import crypt
from getpass import getpass
from random import SystemRandom ; random = SystemRandom()
from string import ascii_lowercase, ascii_uppercase, digits
salt_chars = ascii_lowercase + ascii_uppercase + digits
# generate a SHA-512 passphrase from user input with a 16 byte random salt
@naftulikay
naftulikay / generate-complex-passphrase.py
Created October 13, 2016 05:59
Generate a random password with a given problem space complexity.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from math import ceil, log
from string import ascii_lowercase, ascii_uppercase, digits
# use system random
from random import SystemRandom
random = SystemRandom()
@naftulikay
naftulikay / ManualVideoCompile.java
Created June 27, 2012 19:43
Generate a video from scratch with Xuggler
package org.tkassembled.xuggle;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@naftulikay
naftulikay / pulseaudio-switch.py
Created May 10, 2013 03:57
A quick and dirty script to transfer all PulseAudio streams between two sinks.
#!/usr/bin/env python
from argparse import ArgumentParser
import json, os, re, subprocess
def main():
parser = ArgumentParser()
args = parser.parse_args()
@naftulikay
naftulikay / .tmux.conf
Last active November 27, 2017 02:23
VIM and TMUX Configuration
# default command key is "o"
set -g prefix C-o
# ------- HOTKEY CONFIGURATION -------
unbind %
unbind ,
# pipe splits horizontally in half
bind | split-window -h
# dash splits vertically in half
bind - split-window -v

Keybase proof

I hereby claim:

  • I am naftulikay on github.
  • I am naftulikay (https://keybase.io/naftulikay) on keybase.
  • I have a public key whose fingerprint is 6D63 865D 1C6E EB0F 92C3 94A1 5D21 FFA2 7D8D CC66

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am naftulikay on github.
  • I am rfkrocktk (https://keybase.io/rfkrocktk) on keybase.
  • I have a public key whose fingerprint is 6D63 865D 1C6E EB0F 92C3 94A1 5D21 FFA2 7D8D CC66

To claim this, I am signing this object: