Skip to content

Instantly share code, notes, and snippets.

View Joe12387's full-sized avatar

Joe Rutkowski Joe12387

  • Crawless
  • New York
  • 12:47 (UTC -04:00)
  • LinkedIn in/joe12387
View GitHub Profile
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@dzuelke
dzuelke / bcrypt.php
Last active March 28, 2023 13:15
How to use bcrypt in PHP to safely store passwords (PHP 5.3+ only)
<?php
// secure hashing of passwords using bcrypt, needs PHP 5.3+
// see http://codahale.com/how-to-safely-store-a-password/
// salt for bcrypt needs to be 22 base64 characters (but just [./0-9A-Za-z]), see http://php.net/crypt
$salt = substr(strtr(base64_encode(openssl_random_pseudo_bytes(22)), '+', '.'), 0, 22);
// 2y is the bcrypt algorithm selector, see http://php.net/crypt
// 12 is the workload factor (around 300ms on my Core i7 machine), see http://php.net/crypt
@wimleers
wimleers / opentracker.torrent.php
Created November 19, 2010 15:31
.torrent creator in PHP, for easier Drupal integration in the future.
<?php
/**
* Converts a specified structure into its bencoded form. Acceptable values
* include: integers, strings, arrays, and assoc. arrays.
* Note that associative arrays are encoded into dictionaries while
* non-associative arrays are encoded into lists.
*
* This was copied from http://drupal.org/project/bittorrent