View hlc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Hierarchical link clustering | |
============================ | |
:Author: Tamás Nepusz | |
This is an implementation of the hierarchical link clustering algorithm of Ahn | |
et al. The results provided by this implementation match those of the original |
View generate-key-mac.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# On OS X, use this script to generate an encrypted deployment key for Travis CI. | |
# Dependencies: | |
# gem install travis | |
# brew install coreutils | |
if [ $# -lt 1 ]; then | |
echo "usage: $0 <user>/<repo>" |
View php54.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Xcode, Command Line Tools, Xquartz (on 10.8) | |
# In a terminal (probably best to do one thing at a time): | |
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)" | |
brew tap homebrew/dupes | |
brew tap josegonzalez/homebrew-php | |
brew install php54 --with-mysql | |
chmod -R ug+w /usr/local/Cellar/php54/5.4.7/lib/php | |
pear config-set php_ini /usr/local/etc/php/5.4/php.ini |
View class-query-iterator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Iterates over results of a query, split into many queries via LIMIT and OFFSET | |
*/ | |
class QueryIterator implements Iterator { | |
var $limit = 500; | |
var $query = ''; | |
var $global_index = 0; |
View router.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$root = $_SERVER['DOCUMENT_ROOT']; | |
chdir( $root ); | |
$path = '/'.ltrim( parse_url( $_SERVER['REQUEST_URI'] )['path'],'/' ); | |
if ( file_exists( $root.$path ) ) | |
{ | |
if ( is_dir( $root.$path ) && substr( $path,strlen( $path ) - 1, 1 ) !== '/' ) | |
{ |
View .gitconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
repositoryformatversion = 0 | |
filemode = true | |
bare = false | |
logallrefupdates = true | |
autocrlf = false | |
[remote "origin"] | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
url = git@github.com:Courseware/buddypress-courseware.git | |
[branch "master"] |
View gist:3906950
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Intial git svn clone: | |
# git svn clone --prefix=svn/ -A ~/.svn2git/authors -s https://svn.wxwidgets.org/svn/wx/wxWidgets wxWidgets | |
cd ~/svn-git-mirrors/wxWidgets; | |
if [ -f .sync-running-wxWidgets ]; then exit 1; fi; | |
touch .sync-running-wxWidgets |
View latency.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 2K bytes over 1 Gbps network 20,000 ns | |
Disk seek (SSD) 100,000 ns | |
Read 1 MB sequentially from memory 250,000 ns | |
Round trip within same datacenter 500,000 ns |
View sad-php-attempt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find related posts | |
$related = p2p_type( 'brand_to_product' )->get_related( get_queried_object_id() ); | |
// Display related posts | |
if ( $related->have_posts() ) : | |
?> | |
<?php while ( $related->have_posts() ) : $related->the_post(); ?> | |
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br /> | |
<?php endwhile; ?> |
View generate_update.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "@@@ @@@ @@@@@@@@ @@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ " | |
echo "@@@ @@@ @@@@@@@@ @@@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ " | |
echo "@@! !@@ @@! @@!@!@@@ @@! @@! @@! !@@ " | |
echo "!@! @!! !@! !@!!@!@! !@! !@! !@! @!! " | |
echo " !@@!@! @!!!:! @!@ !!@! @!! @!!!:! @!@@!@! " | |
echo " @!!! !!!!!: !@! !!! !!! !!!!!: !!@!!! " | |
echo " !: :!! !!: !!: !!! !!: !!: !!: :!! " | |
echo ":!: !:! :!: :!: !:! :!: :!: :!: !:! " |
NewerOlder