Skip to content

Instantly share code, notes, and snippets.

View ryansch's full-sized avatar

Ryan Schlesinger ryansch

View GitHub Profile
@ryansch
ryansch / s3up.py
Created May 17, 2011 22:51 — forked from mtigas/0001.markdown
Command-line s3 uploader that uses the MultiPart (chunked) S3 upload functionality to parallelize and speed up large file uploads.
#!/usr/bin/env python
# coding=utf-8
#
# s3up.py
# 2010-2011, Mike Tigas
# https://mike.tig.as/
#
# Usage:
# s3up filename
# Uploads the given file to the DEFAULT_BUCKET (see below)
@ryansch
ryansch / stackscript.sh
Last active December 18, 2020 17:39
linode stackscript for bootstrapping ubuntu with docker
#!/bin/bash
set -euo pipefail
#<UDF name="name" label="Node name">
source <ssinclude StackScriptID="1">
#source ./bash.sh
echo "Setting up ubuntu user's ssh key"
# add_newline = false
[username]
# show_always = true
style_root = "red"
style_user = "purple"
[hostname]
# ssh_only = false
style = "yellow"
@ryansch
ryansch / hooks_controller.rb
Created September 28, 2010 15:03
Rails Controller for Chargify Webhooks
require 'md5'
class Chargify::HooksController < ApplicationController
protect_from_forgery :except => :dispatch
before_filter :verify, :only => :dispatch
EVENTS = %w[ test signup_success signup_failure renewal_success renewal_failure payment_success payment_failure billing_date_change subscription_state_change subscription_product_change ].freeze
def dispatch
event = params[:event]
@ryansch
ryansch / init.vim
Last active May 1, 2019 16:20
neovim config
let g:ale_use_global_executables = 1
call plug#begin('~/.config/nvim/plugged')
Plug 'Shougo/denite.nvim'
Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}}
Plug 'w0rp/ale'
Plug 'maximbaz/lightline-ale'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" Plug 'autozimu/LanguageClient-neovim', {
@ryansch
ryansch / README.md
Last active February 5, 2019 21:18
openvpn-armhf

Configure openvpn

You can run this entire first section with ryansch/openvpn:latest on a more powerful machine than the pi.

OVPN_DATA="ovpn-data"

docker run -v $OVPN_DATA:/etc/openvpn --rm ryansch/openvpn:latest ovpn_genconfig -d -N -b -C AES-256-CBC -T TLS-DHE-RSA-WITH-AES-256-GCM-SHA384 -a SHA512 -n 192.168.8.1 -p 'route 192.168.8.0 255.255.255.0' -u udp://<OPENVPN_HOST> -e 'topology subnet' -p 'dhcp-option DOMAIN <LAN_DOMAIN>' -E 'remote <OPENVPN_HOST> 443 tcp'

docker run -v $OVPN_DATA:/etc/openvpn --rm -it -e EASYRSA_KEY_SIZE=4096 ryansch/openvpn:latest ovpn_initpki

@ryansch
ryansch / elasticsearch14.rb
Created March 31, 2015 15:13
Elasticsearch 1.4 Formula
class Elasticsearch14 < Formula
homepage "http://www.elastic.co"
url "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.4.tar.gz"
sha1 "963415a9114ecf0b7dd1ae43a316e339534b8f31"
depends_on :java => "1.7+"
def cluster_name
"elasticsearch_#{ENV["USER"]}"
end
@ryansch
ryansch / README.md
Created July 23, 2016 22:24
neovim + yadr
@ryansch
ryansch / tar.rb
Created June 16, 2016 12:17
Create/Extract a tarball from ruby
require 'find'
require 'archive/tar/minitar'
module IdiomaticTar
def create_tarball(filename:, directory:)
base_dir = Pathname.new(directory).parent
FileUtils.cd(base_dir) do
Pathname.new(filename).open('wb') do |tarball|
Zlib::GzipWriter.wrap(tarball) do |gz|
Archive::Tar::Minitar::Output.open(gz) do |tar|
docker images | tail -n +2 | grep -v "none" | awk '{printf("%s:%s\n", $1, $2)}' | while read IMAGE; do
echo $IMAGE
filename="${IMAGE//\//-}"
filename="${filename//:/-}.docker-image.tar.gz"
docker save ${IMAGE} | pigz --stdout > $filename
done