Skip to content

Instantly share code, notes, and snippets.

View mckern's full-sized avatar

Ryan McKern mckern

View GitHub Profile
@mckern
mckern / upload.py
Last active June 2, 2016 00:40
Basic upload form, checksums files if they're uploaded, doesn't overwrite
#!/usr/bin/env python
'''
upload.py, a basic CGI scipt to enable uploading a file
onto a web server without direct SSH or filesystem access.
Insecure by design, and in no way intended for public usage.
Integrate it with your favorite internal chat robot, drop
it into a continuous integration pipeline, or just use the
best-of-1994 form interface directly!
mckern@flexo ~ $ cat ~/.vimrc
set number              " show line numbers
set cursorline          " highlight current line
set lazyredraw
set incsearch           " search as characters are entered
set hlsearch            " highlight matches
filetype indent on      " load filetype-specific indent files

mckern@flexo ~ $
@mckern
mckern / preinstall.sh
Created November 24, 2014 19:31
Blue Jeans browser plugiin 'preinstall' script
#!/bin/sh
#
# Installation script that bypasses normal installation procedures and instead
# delivers the payload (the plugin) directly to the user directory
#
# Blue Jeans Network, 2012 - Luke Ma
# ===========================================================================
# Remove old plugin
rm -rf ~/Library/Internet\ Plug-Ins/rbjnplugin*
@mckern
mckern / ssh_agent.sh
Last active August 29, 2015 14:10
Initializing SSH agent settings
#!/bin/bash
function test_socket {
if [[ ${SSH_AUTH_SOCK+_} && -S ${SSH_AUTH_SOCK} ]]; then
: "Socket found"
return 0
fi
: "No socket found"
return 1
}
@mckern
mckern / ini_to_env.py
Last active August 29, 2015 14:08
Convert a set of INI file configurations into shell variables... for... thing?
#!/usr/bin/env python
"""A simple ini config parser, which parses data passed across STDIN
and echos the values of an ini file to the local environment
as KEY=VALUE pairs based on the section of the ini file that they're in.
For example, the key "name" in section "config" would look like this:
\t[config]
\tname=value
This would be echoed back as:
@mckern
mckern / .gitconfig
Last active December 2, 2016 22:35
This is my gitconfig; please consider it a useful reference. May be slightly out of date but generally current.
[user]
name = Ryan McKern
email = ryan.mckern@puppetlabs.com
[color]
diff = auto
status = auto
branch = auto
ui = auto
@mckern
mckern / .bash_profile
Last active September 9, 2017 19:49
This is my .bash_profile. Please consider it a useful reference. Not guaranteed to be completely current or completely quick. I use long-lived shell sessions, so a 2-second load time doesn't bother me.
#!/usr/bin/env bash
# Set up handy aliases, simple environment tweaks, and other pleasantries.
# While shooting yourself in the foot is always a possibility, you may as well
# do it in comfort and occasionally style.
# Owner: Ryan McKern
# Start counting how long it takes to source this profile
__begin="$(date +"%s")"
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# RVM /RBEnv minutia #