Skip to content

Instantly share code, notes, and snippets.

View ianwinter's full-sized avatar

Ian Winter ianwinter

View GitHub Profile
@plentz
plentz / nginx.conf
Last active April 19, 2025 04:46
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@zachleat
zachleat / reading_time.rb
Last active March 20, 2025 09:04
Read this in X minutes Liquid Filter Plugin (for Jekyll)
# Outputs the reading time
# Read this in “about 4 minutes”
# Put into your _plugins dir in your Jekyll site
# Usage: Read this in about {{ page.content | reading_time }}
module ReadingTimeFilter
def reading_time( input )
words_per_minute = 180
@WheresWardy
WheresWardy / filter_date.rb
Created June 4, 2013 11:19
Jekyll/Liquid plugin to add an ordinal suffix to dates
module Jekyll
module DateFilter
def ord(v)
(['1', '21', '31'].include?(v) && "st") ||
(['2', '22'].include?(v) && "nd") ||
(['3', '23'].include?(v) && "rd") ||
"th"
end
def date_post(postdate)
@matsadler
matsadler / setenv.sh
Created May 22, 2013 09:47
Execute a command/script with environment variables read from a .env file. Use like `setenv mycommand arg1 arg2 etc` .env file should look like: VAR1=vlaue1 VAR2=value2
#!/usr/bin/env sh
set -e
dot_env=`cat .env`
env $dot_env $@
@timblair
timblair / ayb12.md
Created November 23, 2012 12:56
Notes from All Your Base 2012, 2012-11-23

AYB12

Alvin Richards: MongoDB

  • Trade-off: scale vs. functionality. MongoDB tries to have good functionality and good scalability.
  • Auto-sharding to maintain equilibrium between shards
  • Scalable datastore != scalable application: use of datastore may still be non-scalable (e.g. many queries across all shards)
  • Get low latency by ensuring shard data is always in memory: datastore
@ppmathis
ppmathis / duo_auth.sh
Created October 14, 2012 13:19
Improved two factor authentication with DuoSecurity
###########################################################
# Two factor authentication with DuoSecurity #
# #
# (c) 2012 P. Mathis <[email protected]> #
###########################################################
# This script will improve the normal UNIX integration #
# of DuoSecurity. You can specify for each SSH subsystem #
# if the two factor authentication is required. #
# #
# I am not responsible for lost or breached servers, #
@ryanjbonnell
ryanjbonnell / gist:3880048
Last active March 23, 2023 18:01
Install Memcache on Mac OS X 10.8 "Mountain Lion"
# memcached requires libevent
cd /usr/local/src
curl -L -O http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz
tar -xvzf libevent-2.0.17-stable.tar.gz
cd libevent-2.0.17-stable*
./configure
make
sudo make install
# Compile memcached utility
module RetryableTyphoeus
require 'typhoeus'
include Typhoeus
DEFAULT_RETRIES = 1
class Request < Typhoeus::Request
def original_on_complete=(proc)
@original_on_complete = proc
@dstroot
dstroot / performance.txt
Created May 25, 2012 01:27
Performance Tuning your TCP Stack
#!/bin/bash
echo "*****************************************"
echo " Based on information from Google"
echo " http://dev.chromium.org/spdy/spdy-best-practices"
echo "*****************************************"
sudo su
yum –y update
echo "*****************************************"
echo " Changing initcwnd and initrwnd"
echo " Step 1: check route settings."
@jpfuentes2
jpfuentes2 / rbenv-install-system-wide.sh
Created March 8, 2012 19:47
CentOS: rbenv install and system wide install
#!/bin/bash
# CentOS rbenv system wide installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \
make bzip2 autoconf automake libtool bison iconv-devel git-core