Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block tszming

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
renchap /
Last active Sep 23, 2019
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {
chrismdp /
Last active Nov 14, 2019
Uploading to S3 in 18 lines of Shell (used to upload builds for
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (
# Based on a modified script from here:
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
View gist:4dcb6892346ff17709fe
local now = tonumber(ARGV[1])
local required = tonumber(ARGV[2])
local rate = tonumber(ARGV[3])
local per_secs = tonumber(ARGV[4])
local do_subtract = tonumber(ARGV[5]) == 1
local full_at = tonumber('GET', KEYS[1])) or 0
local score, result
if full_at < now then
score = rate
ewalk153 / upgrade_postgres.bash
Created Jan 3, 2014
upgrade heroku postgres from crane to yanari
View upgrade_postgres.bash
# this can be done anytime
heroku addons:add heroku-postgresql:standard-yanari --app nav-chronos; heroku pg:wait
# about 3m30s
heroku maintenance:on
heroku ps:scale worker=0
heroku pgbackups:capture --expire
# less than 20 min
dergachev /
Last active Nov 20, 2019
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF


To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

josegonzalez / access.lua
Created Dec 3, 2012
Simple lua file enabling oauth support for nginx via nginx-lua and access_by_lua.
View access.lua
- certain endpoints are always blocked
if nginx_uri == "/_access_token" or nginx_uri == "/_me" then
-- import requirements
local cjson = require "cjson"
-- setup some app-level vars
local app_id = "APP_ID"
View gist:4035968
require 'rubygems'
require 'railsless-deploy'
# Your application name
set :application, "someapp"
# We're not deploying from a repo, since this is scala and we
# need to compile. Set SCM to none
set :scm, :none
# Our deploy is to copy the contents of…
n0ts / gist:3810200
Created Oct 1, 2012
keepalived supervisor.conf
View gist:3810200
--use-file /etc/keepalived/keepalived.conf
--log-facility 0
--pid /var/run/
leandrosilva /
Created Sep 6, 2012
My dumb Python script to stream Syslog messages to a Kafka server
# ==========================
# Getting Started with klogd
# ==========================
# Klogd is a dumb script to stream Syslog messages to a Kafka server.
# 1) Make sure you have all dependencies installed properly
# - Twisted
# - PyParsing
coryalder / fb_open_source_ios
Created Aug 23, 2012
Open source libraries used in the new Facebook app.
View fb_open_source_ios
You can’t perform that action at this time.