Skip to content

Instantly share code, notes, and snippets.

Avatar

Cristi Burcă scribu

View GitHub Profile
@scribu
scribu / hlc.py
Last active Jan 9, 2019 — forked from ntamas/hlc.py
Hierarchical link clustering algorithm of Ahn et al (see http://barabasilab.neu.edu/projects/linkcommunities/), implemented using Python and igraph for fun.
View hlc.py
#!/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
@scribu
scribu / generate-key-mac.sh
Last active Sep 7, 2016 — forked from floydpink/travis-secure-key-mac.sh
Generating secure environment variables for GitHub deployment keys to be used from a Travis-CI build.
View generate-key-mac.sh
#!/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
# 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
<?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;
@scribu
scribu / router.php
Created Nov 16, 2012 — forked from tamagokun/router.php
Run a Wordpress site via PHP's built-in web server
View router.php
<?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 ) !== '/' )
{
@scribu
scribu / .gitconfig
Created Oct 17, 2012 — forked from stas/.gitconfig
WordPress Git SVN config example
View .gitconfig
[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"]
@scribu
scribu / gist:3906950
Created Oct 17, 2012 — forked from tierra/gist:3061041
Script to sync wxWidgets SVN to GitHub
View gist:3906950
#!/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
@scribu
scribu / latency.txt
Created May 31, 2012 — forked from jboner/latency.txt
Latency numbers every programmer should know
View latency.txt
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
@scribu
scribu / sad-php-attempt
Created Feb 23, 2012 — forked from anonymous/sad-php-attempt
poor attempt at php
View sad-php-attempt
// 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; ?>
@scribu
scribu / generate_update.sh
Created Nov 20, 2011 — forked from xentek/generate_update.sh
Generate the necessary sql statements to move a WordPress site from one environment to another
View generate_update.sh
#!/usr/bin/env bash
echo "@@@ @@@ @@@@@@@@ @@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ "
echo "@@@ @@@ @@@@@@@@ @@@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ "
echo "@@! !@@ @@! @@!@!@@@ @@! @@! @@! !@@ "
echo "!@! @!! !@! !@!!@!@! !@! !@! !@! @!! "
echo " !@@!@! @!!!:! @!@ !!@! @!! @!!!:! @!@@!@! "
echo " @!!! !!!!!: !@! !!! !!! !!!!!: !!@!!! "
echo " !: :!! !!: !!: !!! !!: !!: !!: :!! "
echo ":!: !:! :!: :!: !:! :!: :!: :!: !:! "