Skip to content

Instantly share code, notes, and snippets.

<?php
class base58
{
static public $alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
public static function encode($int) {
$base58_string = "";
$base = strlen(self::$alphabet);
while($int >= $base) {
@Ocramius
Ocramius / Session.php
Created November 11, 2011 10:10
Auth Storage adapter for Zend Framework and Doctrine 2
<?php
namespace Ocramius\Auth\Storage;
use Entity\Ocramius\Admin as AdminEntity,
Doctrine\ORM\EntityManager;
/**
* An @see \Zend_Auth_Storage_Session that handles @see AdminEntity items
* @author Marco Pivetta <ocramius@gmail.com>
*/
@dave1010
dave1010 / htaccess
Created December 14, 2011 13:07
HTTP Status Cats Apache (htaccess) config
# HTTP Status Cats
# Apache (htaccess) config created by @dave1010
# Licensed CC BY 2.0
# Images CC BY 2.0, from GirlieMac's photostream:
# http://www.flickr.com/photos/girliemac/sets/72157628409467125/with/6508023065/
# Usage: copy save this file as .htaccess or add it to your httpd.conf
ErrorDocument 404 '<a href="http://www.flickr.com/photos/girliemac/6508022985/" title="404 - Not Found by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7172/6508022985_b22200ced0.jpg" width="500" height="400" alt="404 - Not Found"></a>'
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@tommeier
tommeier / rsync_backup.sh
Created March 20, 2012 00:05
RSync backup script for Mac OSX from External drive
#!/bin/sh
echo "Running..."
PROG=$0
RSYNC="/usr/bin/rsync"
SCRIPT_MOUNTED='false'
MOUNT_VOLUME="/Volumes/Qdownload"
SRC="$MOUNT_VOLUME/transmission/completed/"
DST="/Users/tom/Dumping Ground/Qnap Downloads"
@g3d
g3d / gist:2709563
Last active February 7, 2024 15:21 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan
@elazar
elazar / phpunit-log-junit.php
Created May 25, 2012 23:43
PHPUnit --log-junit processor
<?php
/**
* This script is used to process the output of a PHPUnit test run
* that uses --log-junit for the purposes of timing each executed
* test method. It outputs test methods with their respective
* runtimes in order from largest to smallest. Times are in
* seconds. The script accepts paths to any number of files in the
* JUnit log format.
*
* Ex: php phpunit-log-junit.php /path/to/junit-log1.xml /path/to/junit-log2.xml ...
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active June 5, 2024 13:48
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@jbrooksuk
jbrooksuk / head.html
Created January 5, 2013 19:03
Open graph tags used in my Octopress blog.
<!-- Rich Object stuff -->
<meta property="og:url" value="{{ site.url }}{{ page.url }}">
<meta property="og:type" content="website" />
{% if page.title %}<meta property="og:title" value="{% if page.title %}{{ page.title }}{% endif %}">
<meta property="og:description" value="{% if page.description %}{{ page.description }}{% else %}{{site.description}}{% endif %}">
{% else %}<meta property="og:title" value="{{ site.title }}">
<meta property="og:description" value="{{ description }}">
{% endif %}{% if page.cover %}<meta property="og:image" value="{{ site.url }}{{ page.cover }}">{% endif %}
@13rac1
13rac1 / ansible-create-user-with-password
Created March 18, 2013 22:18
Create a user in an Ansible playbook with a set, but unknown password so the account is not locked. Makes it possible to log on the account with a public key. This example requires mkpasswd, but that can be replaced with any other password generator.
---
- hosts: all
gather_facts: yes
##
# Create the password then create the user
#
- name: Users | Generate password for new user
shell: makepasswd --chars=20
register: user_password