Skip to content

Instantly share code, notes, and snippets.

View todgru's full-sized avatar

todgru

  • Portland, OR
View GitHub Profile
@todgru
todgru / Bcrypt.php
Created September 7, 2012 22:52
Simple PHP 5.3+ Bcrypt class and functions php bcrypt
<?php
/*
By Marco Arment <[email protected]>.
This code is released in the public domain.
THERE IS ABSOLUTELY NO WARRANTY.
Usage example:
// In a registration or password-change form:
#!/usr/bin/perl
use v5.10;
use strict;
use warnings;
# Usage: gist_backup.pl <user>
# Clone all the gists of a GitHub user
#!/bin/sh
#cloneall.sh by Jan-Piet Mens, February 2012
# Obtain a list of gists (mine) and clone them into the current directory
# Requires jsonpipe (https://github.com/dvxhouse/jsonpipe)
URL=http://gist.github.com/api/v1/json/gists/jpmens
CLONEURLFMT="git://gist.github.com/%d.git\n"
curl -qs $URL |
jsonpipe -s ' ' |
require 'rubygems'
require 'net/http'
require 'uri'
BIT_RATE = 48 #6kbxseg * 60 seg (a min) * 15min
TAMO_CORTE = (BIT_RATE/8) * 60 * 15 #en KB
url = URI.parse('http://186.1.15.253:8000/')
Net::HTTP.start(url.host, url.port) do |http|
#!/bin/bash
#
# Report time to first byte for the provided URL using a cache buster to ensure
# that we're measuring full cold-cache performance
while (($#)); do
echo $1
curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" \
-w "%{http_code}\tPre-Transfer: %{time_pretransfer}\tStart Transfer: %{time_starttransfer}\tTotal: %{time_total}\tSize: %{size_download}\n" \
"$1?`date +%s`"

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@todgru
todgru / base58.rb
Created December 6, 2013 19:12 — forked from jou/base58.rb
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2004 Sam Hocevar
# 14 rue de Plaisance, 75014 Paris, France
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@todgru
todgru / _readme.md
Last active January 30, 2023 04:14 — forked from shime/_readme.md
Installing Tmux on Dreamhost tmux dreamhost
#!/usr/bin/env ruby
# Aside from removing Ruby on Rails specific code this is taken verbatim from
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome
# - Ryan Florence (http://ryanflorence.com)
#
# Install this hook to a remote repository with a working tree, when you push
# to it, this hook will reset the head so the files are updated
if ENV['GIT_DIR'] == '.'
wget https://github.com/downloads/libevent/libevent/libevent-2.0.18-stable.tar.gz
tar zxf libevent-2.0.18-stable.tar.gz
cd libevent-2.0.18-stable
sudo ./configure
sudo ./make
DIR="/home/ec2-user/downloads/libevent-2.0.18-stable"
wget http://downloads.sourceforge.net/tmux/tmux-1.9.tar.gz
tar zxf tmux-1.9.tar.gz
cd tmux-1.9