Skip to content

Instantly share code, notes, and snippets.

@jwreagor
jwreagor / delayed_job
Created March 3, 2011 01:47
DelayedJob Munin script.
#!/usr/bin/env ruby
# by Helder Ribeiro 2009
#
# Plugin to monitor delayed_jobs' queue size
# Gives updates with number of jobs that haven't been started yet
# plus the ones that failed and are still rescheduled for another run
#
# Parameters supported:
#
# config
@farleylai
farleylai / build.gradle
Last active November 19, 2015 06:55
A Complete build.gradle for the Experimental Android Gradle Plugin
apply plugin: 'com.android.model.application'
def MSB = ['AutoCor', 'BitonicSort', 'BitonicSortRecursive', 'FFT2', 'FFT3', 'FIR', 'FIRcoarse', 'FMRadio']
MSB << 'MatrixMult' << 'MatrixMultBlock' << 'MergeSort' << 'Repeater'
MSB << 'BeepBeep' << 'MFCC' << 'Crowd'
model {
compileOptions.with {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
@nerdtalker
nerdtalker / EXIFmover.py
Last active April 8, 2017 14:34
EXIFmover - Moves Dropbox Camera uploaded Images into sensible directories
# Name: EXIFmover.py
# Author: Brian Klug (@nerdtalker / brian@brianklug.org)
# Purpose:
# Move Files into directory based on EXIF data make and model
# Designed to un-clusterfuck the Dropbox camera upload directory which is a mess of every
# JPEG and PNG ever if you use it like I do on a bunch of phones, and thus totally unwieldy
# and full of images sorted by date or else nothing sometimes, dropbox seems nondeterminstic
# Moves files into /[Image Make]+[Image Model]/ eg /Camera Uploads/LGE Nexus 4/
@jotto
jotto / google_oauth2_access_token.rb
Created June 14, 2012 21:15
ruby command line script for generating google oauth2 access token
# (create oauth2 tokens from Google Console)
client_id = ""
client_secret = ""
# (paste the scope of the service you want here)
# e.g.: https://www.googleapis.com/auth/gan
scope = ""
@eezis
eezis / gist:eddd935a942f24936dcf41edf780be9b
Created October 21, 2016 19:54
Spread locust.io across cores using the multiprocessing library
import sys
import subprocess
import multiprocessing
# use htop to see the utilization rates spread across cores
# use locust --help to see all the options
# the cmd launches 500 concurrent users on each core, hatch 5 per second, issue 10k requests then stops
# logs to results.txt, prints the summary in the terminal
@darrenboyd
darrenboyd / Gemfile
Created February 16, 2015 19:31
Setup carrierwave in Rails with just fog-aws.
# your Gemfile should look something like...
gem 'fog-aws', require: false # or require: 'fog/aws'
# avoid having carrierwave loading during bundler
# setup. We need to get ./lib in the load_path first.
gem 'carrierwave', require: false
@ctalkington
ctalkington / Gemfile
Last active May 16, 2023 20:19
Nginx, Sinatra, and Puma.
source :rubygems
gem "puma"
gem "sinatra"
@ricardochimal
ricardochimal / gist:293517
Created February 3, 2010 09:48
256 color bash prompt
function smart_pwd {
local pwdmaxlen=25
local trunc_symbol=".."
local dir=${PWD##*/}
local tmp=""
pwdmaxlen=$(( ( pwdmaxlen < ${#dir} ) ? ${#dir} : pwdmaxlen ))
NEW_PWD=${PWD/#$HOME/\~}
local pwdoffset=$(( ${#NEW_PWD} - pwdmaxlen ))
if [ ${pwdoffset} -gt "0" ]
@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@djo
djo / deploy.rb
Last active December 21, 2023 07:08
Rails, Nginx, XSendfile, and X-Accel-Mapping
# Symlink the shared protected folder
run "ln -nfs #{shared_path}/protected #{latest_release}/protected"