This is a simple modification of the Force directed d3.js demo that keeps the x co-ordinate fixed.
This file contains hidden or 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 | |
/* | |
David Hayes [email protected] | |
Quasi-minimal viable Raplet: | |
// */ | |
$in = $_GET; //[email protected]&name=Rahul%20Vohra&twitter_username=rahulvohra&callback=jsonp123456789 | |
$jsonContainer = $in['callback']; |
This file contains hidden or 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 | |
/* | |
David Hayes [email protected] | |
Quasi-minimal viable Raplet: | |
// */ | |
$in = $_GET; //[email protected]&name=Rahul%20Vohra&twitter_username=rahulvohra&callback=jsonp123456789 | |
$jsonContainer = $in['callback']; |
This file contains hidden or 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
$img = imageCreateTrueColor(512, 512); | |
for ($i=0; $i < 512; $i++) { | |
for ($j=0; $j < 512; $j++) { | |
$c=mt_rand(0,255); | |
$col = imageColorAllocate($img, $c, $c, $c); | |
imagesetpixel($img, $i, $j, $col); | |
} | |
} | |
header("Content-Type: image/png"); | |
imagepng($img); |
This file contains hidden or 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
@rem Simple recursive backup script [email protected] 2011 | |
@echo off | |
rem I strongly recommend backing up to a different drive or machine | |
set sourcedir=c:\projects | |
set destdir=g:\autobackups\projects | |
for /f "tokens=1-3 delims=/ " %%g in ('date /t') do ( | |
set mm=%%g | |
set dd=%%h |
This file contains hidden or 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
@echo off | |
set destdir=G:\autobackups | |
set devicefile=htc_desire | |
for %%d in (E F G H I J K L) do ( | |
if exist %%d:\%devicefile% ( | |
echo %%d is the %devicefile% | |
xcopy %%d:\ "%destdir%\%devicefile%" /V /E /D /C /I /Y > %destdir%\%devicefile%\lastbackup.txt | |
) | |
) |
This file contains hidden or 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
<? | |
// One Time Pad from string demo. | |
// http://euri.ca/2012/11/encryption-that-calls-home-skyfall-movie-magic/ | |
// Don't use this in production, obviously since you can brute force the seed. | |
// (Actually coming up with a server that generates OTPs in response to a seed is a decent problem) | |
$seed = "LOCALSECRET" + $_SERVER["QUERY_STRING"]; | |
$hash = hash('sha256', $seed); | |
$dec = hexdec($hash); | |
mt_srand($dec); |
This file contains hidden or 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
# Bash script to upload files to static s3 hosting with s3cp | |
# [email protected] April 30th, 2013 | |
# Modified from https://github.com/roqs23/sync-svn-updates-to-s3/blob/master/svnupd2s3.sh | |
export COMMON_HEADER="--header \"x-amz-acl: public-read\" --header \"Vary: Accept-Encoding\" " | |
export HTML_HEADER="--header \"Cache-Control: max-age=604800,must-revalidate\" --header \"Content-Type: text/html\"" | |
export CSS_HEADER="--header \"Cache-Control: max-age=604800,must-revalidate\" --header \"Content-Type: text/css\"" | |
export JS_HEADER="--header \"Cache-Control: max-age=604800,must-revalidate\" --header \"Content-Type: application/javascript\"" | |
export PNG_HEADER="--header \"Cache-Control: max-age=2592000,must-revalidate\" --header \"Content-Type: image/png\"" | |
export GIF_HEADER="--header \"Cache-Control: max-age=2592000,must-revalidate\" --header \"Content-Type: image/gif\"" |
This file contains hidden or 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
Sample PHP code to accept PagerDuty webhooks and send out notifications by email on state changes. | |
For more information, see http://developer.pagerduty.com/documentation/rest/webhooks | |
This example threads emails based on "$status: $description on $service" so each update to each incident would start a new thread. | |
This code is unsupported by PagerDuty. | |
<?php | |
$emailAddress = "[email protected]"; | |
This file contains hidden or 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
require 'csv' | |
#Parse the CSV that Twilio provides https://www.twilio.com/resources/rates/international-rates.csv | |
numbers = [] | |
CSV.foreach('international-rates.csv', :headers => true) do |row| | |
starts = row[2].split(",") | |
starts.each do |p| | |
numbers.push([p.strip, p.strip.length, row[1], row[0]]) | |
end | |
end |
OlderNewer