Skip to content

Instantly share code, notes, and snippets.

@defunkt
defunkt / gitio
Created September 11, 2011 08:11
Turn a github.com URL into a git.io URL.
#!/usr/bin/env ruby
# Usage: gitio URL [CODE]
#
# Turns a github.com URL
# into a git.io URL
#
# Copies the git.io URL to your clipboard.
url = ARGV[0]
code = ARGV[1]
@nateabele
nateabele / routes.php
Last active June 16, 2017 13:05
Lithium continuation route examples
<?php
/**
* Continuation routing examples. Handles URLs in the following forms:
*
* /posts
* /en/posts
* /admin/posts
* /admin/en/posts
* /admin/en/posts.json
* /admin/en/posts/4ef16ccc7f8b9aa331000064.json
@jperras
jperras / deb-control.sh
Created May 14, 2012 18:17
For when you need to dive into a .deb and edit the control file.
#!/bin/bash
if [[ -z "$1" ]]; then
echo "Syntax: $0 debfile"
exit 1
fi
DEBFILE="$1"
TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
OUTPUT=`basename "$DEBFILE" .deb`.modified.deb
@meirish
meirish / mbriggs.theme.bash
Created May 20, 2012 21:35
bash-it mbriggs change to add virtualenv
# ------------------------------------------------------------------#
# FILE: mbriggs.zsh-theme #
# BY: Matt Briggs (matt@mattbriggs.net) #
# BASED ON: smt by Stephen Tudor (stephen@tudorstudio.com) #
# ------------------------------------------------------------------#
SCM_THEME_PROMPT_DIRTY="${red}⚡${reset_color}"
SCM_THEME_PROMPT_AHEAD="${red}!${reset_color}"
SCM_THEME_PROMPT_CLEAN="${green}✓${reset_color}"
SCM_THEME_PROMPT_PREFIX=" "
@mariuswilms
mariuswilms / pre-commit
Last active May 19, 2022 09:36
Git pre-commit Hook
#!/bin/bash
#
# Language agnostic GIT pre commit hook.
#
# Copyright (c) 2013 Marius Wilms.
# All rights reserved.
#
# Distributed under the terms of the BSD 3-clause license. Redistributions
# of this file must retain the above copyright notice. For the full license
# text see: http://opensource.org/licenses/BSD-3-Clause.
@oerd
oerd / chart.impact.js
Created June 4, 2012 14:20 — forked from mehlah/chart.impact.js
d3 impact graph
// Inspired by http://dmitry.baranovskiy.com/work/github/
d3.chart.impact = function() {
var width = 1,
height = 1,
duration = 0,
domain = null,
values = Object,
key = d3_chart_impactKey,
value = d3_chart_impactValue,
sort = null,
@dAnjou
dAnjou / flask-upload
Created June 5, 2012 12:35
Flask upload example
<VirtualHost *>
ServerName example.com
WSGIDaemonProcess www user=max group=max threads=5
WSGIScriptAlias / /home/max/Projekte/flask-upload/flask-upload.wsgi
<Directory /home/max/Projekte/flask-upload>
WSGIProcessGroup www
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
@tmaiaroto
tmaiaroto / virtual.conf
Created August 9, 2012 18:48
Nginx Virtual Host Setup for OS X using Homebrew
#
# A virtual host using mix of IP-, name-, and port-based configuration.
# This is based on using Homebrew for OS X. You can use this in other
# cases though, but you'll likely need to adjust some of the paths below.
#
server {
# Replace this port with the right one for your requirements
# listen 80 [default|default_server]; #could also be 1.2.3.4:80
@jordansissel
jordansissel / RESULTS.md
Created September 21, 2012 07:41
screenshot + code showing how to query logstash/elasticsearch with a graphite function.

logstash queries graphed with graphite.

Operation: Decouple whisper from graphite.

Method: Create a graphite function that does a date histogram facet query against elasticsearch for a given query string for the time period viewed in the current graph.

Reason: graphite has some awesome math functions. Wouldn't it be cool if we could use those on logstash results?

The screenshot below is using logstash to watch the twitter stream of keywords "iphone" "apple" and "samsung" - then I graph them each, so we get an idea of popularity. As a bonus, I also do a movingAverage() on the iphone curve to show you why this is awesome.

@josegonzalez
josegonzalez / nginx-custom.rb
Created November 21, 2012 17:53
Customize your Nginx Installation via Homebrew
require 'formula'
class NginxCustom < Formula
homepage 'http://nginx.org/'
url 'http://nginx.org/download/nginx-1.2.4.tar.gz'
sha1 'e3de0b2b82095f26e96bdb461ba36472d3e7cdda'
devel do
url 'http://nginx.org/download/nginx-1.3.8.tar.gz'
sha1 '84ff39e3f76e9f496f4e05080885e04caf472bb9'