Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Schlesinger ryansch

View GitHub Profile
@ryansch
ryansch / s3up.py
Created May 17, 2011 — 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.
View s3up.py
#!/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 Dec 18, 2020
linode stackscript for bootstrapping ubuntu with docker
View stackscript.sh
#!/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"
View starship.toml
# 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 Sep 28, 2010
Rails Controller for Chargify Webhooks
View hooks_controller.rb
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
neovim config
View init.vim
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 Feb 5, 2019
openvpn-armhf
View README.md

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 Mar 31, 2015
Elasticsearch 1.4 Formula
View elasticsearch14.rb
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
View README.md
@ryansch
ryansch / tar.rb
Created Jun 16, 2016
Create/Extract a tarball from ruby
View tar.rb
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|
View docker-backup-all-images.sh
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
You can’t perform that action at this time.