Skip to content

Instantly share code, notes, and snippets.

🌞
DO YOU EVEN ADHERE BRO

Naftuli Kay naftulikay

🌞
DO YOU EVEN ADHERE BRO
View GitHub Profile
@naftulikay
naftulikay / systemd-socket-example.md
Created May 3, 2016
Example of how Docker uses SystemD's socket mechanism.
View systemd-socket-example.md

SystemD Socket Example

/usr/lib/systemd/system/docker.service

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
@naftulikay
naftulikay / creepy.py
Last active May 2, 2016
Bad Things in Python
View creepy.py
class Innocent(object):
value = []
i0 = Innocent()
i0.value.append("lulz")
i1 = Innocent()
print(i1.value)
@naftulikay
naftulikay / generate-ec2-inventory.sh
Created Mar 26, 2016
Generate an Ansible Inventory for EC2 instances with a given name.
View generate-ec2-inventory.sh
#!/bin/bash
if [ -z "$1" ]; then
echo "$0 takes one argument; the value of the name tag of EC2 instances to search for." >&2
exit 1
fi
name="$1"
# create a header for the inventory with a group name of "all"
@naftulikay
naftulikay / c12n-assemble.py
Last active Jan 8, 2016
CloudFormation YAML Assembler
View c12n-assemble.py
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import argparse
import glob
import json
import os
import sys
import yaml
@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
@naftulikay
naftulikay / .tmux.conf
Last active Nov 27, 2017
VIM and TMUX Configuration
View .tmux.conf
# 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
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(
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:
@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]"
@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
You can’t perform that action at this time.