Skip to content

Instantly share code, notes, and snippets.

View soopercorp's full-sized avatar
🚲

hardy soopercorp

🚲
View GitHub Profile
@soopercorp
soopercorp / server.sh
Created September 26, 2012 23:33
1 file server
{ echo -ne "HTTP/1.0 200 OK\r\n\r\n"; cat some.file; } | nc -l 8080
@soopercorp
soopercorp / https.rb
Created August 13, 2012 16:10
make https call in ruby
url = URI.parse('https://api.xyz.com/v1/method?auth_token=adjfsdjfsdflsd')
req = Net::HTTP::Get.new(url.path)
response = Net::HTTP.start(url.host, use_ssl: true) do |http|
http.get url.request_uri
end
@soopercorp
soopercorp / callFunction.m
Created June 29, 2012 21:18
Simple REST calls with Objective-c
NSString *twitterReqUrl = @"http://api.twitter.com/1/statuses/user_timeline.atom?screen_name=hardikr";
NSString *resp = [self makeRestCall:twitterReqUrl];
@soopercorp
soopercorp / email.m
Last active October 6, 2015 14:38
linker error
CTCoreMessage *msg = [[CTCoreMessage alloc] init];
CTCoreAddress *from = [[CTCoreAddress alloc] initWithName:@"Hardik Ruparel" email:@"####@gmail.com"];
[msg setTo:[NSSet setWithObject:from]];
[msg setFrom:[NSSet setWithObject:from]];
NSLog(@"%@",[NSSet setWithObject:@"####@gmail.com"]);
[msg setBody:@"Testing Body"];
[msg setSubject:@"dshjksdsd"];
@soopercorp
soopercorp / encrypt workflow
Created June 8, 2012 20:09
working-settings
mkdir -p $HOME/easyenc/$1
open /Users/sai/Library/Developer/Xcode/DerivedData/EasyEnc-ahcijzhfiqmlflaaoouiwxbrrkjb/Build/Products/Debug/EasyEnc.app --args -e $1 $HOME/easyenc/$1
sleep 4
open $HOME/easyenc/$1
@soopercorp
soopercorp / gist:2877665
Created June 5, 2012 20:34
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@soopercorp
soopercorp / uniq.py
Created April 4, 2012 21:02
unique elts
# Question:
# You are given an array A[1..N] and a number of queries of the form (L,H).
# For each query, compute the number of unique elements in the array A between indices L and H inclusive.
# That is, you need to count the number of elements which occur exactly once in the index range [L..H].
from collections import Counter
arr_size = raw_input()
arr = []
@soopercorp
soopercorp / extract.py
Created April 4, 2012 21:01
nlp-hw2-extract
#!/usr/bin/env python
import pprint
import string
import cPickle as pickle
import sys
from nltk.corpus import wordnet as wn
#pretty print