Skip to content

Instantly share code, notes, and snippets.

View siddarth's full-sized avatar

Siddarth Chandrasekaran siddarth

View GitHub Profile
### Keybase proof
I hereby claim:
* I am siddarth on github.
* I am siddarth (https://keybase.io/siddarth) on keybase.
* I have a public key whose fingerprint is 9F8D D1D6 1875 F63D CBE5 5A33 6702 E6C2 4A11 1160
To claim this, I am signing this object:
@siddarth
siddarth / gist:6241382
Created August 15, 2013 14:44
Stripe FX: Getting the converted amount from the BalanceTransaction

Creating a USD charge on a GBP account:

$ curl https://api.stripe.com/v1/charges \
    -u REDACTED: \
    -d amount=400 \
    -d currency=usd \
    -d card[number]=4242424242424242 \
    -d card[exp_month]=04 \
    -d card[exp_year]=16 \

-d card[cvv]=390 \

# H/T: http://stackoverflow.com/questions/6240808/count-line-changes-with-git
git log --stat --author $(git config --get user.email) --since="$(ruby -e "print Time.now - 24*60*60")" --until="now" | awk -F',' '/files? changed/ {
files += $1
insertions += $2
deletions += $3
}
END {
print "Files Changed: " files
print "Insertions: " insertions
require 'rubygems'
require 'sinatra'
get '/anonymous' do
"<html><body><a href='data:text/html;charset=utf-8,<html><script>window.location=\"http://localhost:4567/request\";</script></html>'>Link</a></body></html>"
end
get '/request' do
request.referer.inspect
end
function find(what, current) {
var ret;
if (!current) {
current = window.top;
}
for (var i=0; i < current.frames.length;i++) {
if (current.frames[i].name == what){
return current.frames[i];
}
ret = find(what,current.frames[i]);
@siddarth
siddarth / gist:1379771
Created November 20, 2011 03:32
Stripe PHP simple example with amount
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("STRIPE_API_KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
@siddarth
siddarth / gist:1379745
Created November 20, 2011 02:53 — forked from gdb/gist:1255035
Stripe PHP simple example
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
#include <stdio.h>
#include <glob.h>
#include <unistd.h>
#include <assert.h>
#define PATH_SIZE 1024
#define FD_PATH "/proc/%d/fd/*.*"
int main(int argc, char **argv) {
int pid = getpid();
diff --git a/lib/heliotrope/message.rb b/lib/heliotrope/message.rb
index 5d6fe10..0ff640e 100644
--- a/lib/heliotrope/message.rb
+++ b/lib/heliotrope/message.rb
@@ -172,9 +172,10 @@ private
if part.multipart?
if mime_type_for(part) =~ /multipart\/alternative/
target = part.body.find { |p| mime_type_for(p).index(preferred_type) } || part.body.first
- decode_mime_parts target, preferred_type, level + 1
+ decode_mime_parts target, preferred_type, level + 1 unless target.nil?
$ port search scala
cassandra @0.6.0 (databases)
A highly scalable, eventually consistent, distributed, structured key-value store.
dspam @3.9.0 (mail, net)
Scalable, open-source statistical anti-spam filter
mkpwd @0.7 (sysutils)
mkpwd is a scalable password generator