Skip to content

Instantly share code, notes, and snippets.

View pulkitsinghal's full-sized avatar

Pulkit Singhal pulkitsinghal

View GitHub Profile
@pulkitsinghal
pulkitsinghal / Chef Works
Created May 26, 2012 20:26
Sometimes Chef works, sometimes it doesn't
[Sat, 26 May 2012 20:15:54 +0000] INFO: *** Chef 0.10.8 ***
[Sat, 26 May 2012 20:15:55 +0000] INFO: Setting the run_list to ["recipe[elasticsearch::plugin_head]"] from JSON
[Sat, 26 May 2012 20:15:55 +0000] INFO: Run List is [recipe[elasticsearch::plugin_head]]
[Sat, 26 May 2012 20:15:55 +0000] INFO: Run List expands to [elasticsearch::plugin_head]
[Sat, 26 May 2012 20:15:55 +0000] INFO: Starting Chef Run for elasticsearch-test-1
[Sat, 26 May 2012 20:15:55 +0000] INFO: Running start handlers
[Sat, 26 May 2012 20:15:55 +0000] INFO: Start handlers complete.
[Sat, 26 May 2012 20:15:55 +0000] INFO: Processing service[elasticsearch] action enable (elasticsearch::plugin_head line 1)
[Sat, 26 May 2012 20:15:56 +0000] INFO: Processing bash[/usr/local/bin/plugin -install mobz/elasticsearch-head] action run (elasticsearch::plugin_head line 5)
[Sat, 26 May 2012 20:15:56 +0000] INFO: bash[/usr/local/bin/plugin -install mobz/elasticsearch-head] sh("bash" "/tmp/chef-script20120526-3214-1c3ebdq-0")
@pulkitsinghal
pulkitsinghal / bootstrap.sh
Created May 29, 2012 00:14 — forked from karmi/.gitignore
Bootstrap, install and configure ElasticSearch with Chef Solo
echo -e "\nInstalling development dependencies and essential tools..." \
"\n===============================================================================\n"
yum install gcc gcc-c++ make automake install ruby-devel libcurl-devel libxml2-devel libxslt-devel vim tree curl git -y
echo -e "\nInstalling Rubygems..." \
"\n===============================================================================\n"
yum install rubygems -y
echo -e "\nInstalling and bootstrapping Chef..." \
"\n===============================================================================\n"
@pulkitsinghal
pulkitsinghal / debug.log
Created May 30, 2012 18:51
Do attributes evaluate to false for only_if in templates?
time ssh -t $SSH_OPTIONS $HOST "sudo chef-solo -l debug --node-name elasticsearch-test-1 -j /tmp/run-3.json"
[Wed, 30 May 2012 18:45:59 +0000] INFO: *** Chef 0.10.8 ***
[Wed, 30 May 2012 18:46:00 +0000] DEBUG: Building node object for elasticsearch-test-1
[Wed, 30 May 2012 18:46:00 +0000] DEBUG: Extracting run list from JSON attributes provided on command line
[Wed, 30 May 2012 18:46:00 +0000] INFO: Setting the run_list to ["recipe[elasticsearch::plugin_jetty]"] from JSON
[Wed, 30 May 2012 18:46:00 +0000] DEBUG: Applying attributes from json file
[Wed, 30 May 2012 18:46:00 +0000] DEBUG: Platform is amazon version 2012.03
[Wed, 30 May 2012 18:46:00 +0000] INFO: Run List is [recipe[elasticsearch::plugin_jetty]]
[Wed, 30 May 2012 18:46:00 +0000] INFO: Run List expands to [elasticsearch::plugin_jetty]
[Wed, 30 May 2012 18:46:00 +0000] INFO: Starting Chef Run for elasticsearch-test-1
function getUUID() {
nano.request(
{
method : 'GET',
path : '_uuids?count=1'
},
function (err, body, headers) {
if (err) {
console.error(err);
} else {
@pulkitsinghal
pulkitsinghal / couchdb.log
Created June 21, 2012 15:28
TouchDB failed authentication when DB has reader role
[Thu, 21 Jun 2012 15:19:23 GMT] [debug] [<0.6665.0>] Accounted method: 'GET'
[Thu, 21 Jun 2012 15:19:31 GMT] [debug] [<0.6660.0>] 'GET' /mydb/_local/3eb1c1e3df111486a307de430e1acda7a60ffa68 {1,1} from "10.10.43.114"
Headers: [{'Accept',"application/json"},
{'Accept-Encoding',"gzip, deflate"},
{'Accept-Language',"en-us"},
{'Connection',"keep-alive"},
{'Host',"mydomain.iriscouch.com"},
{'User-Agent',"TouchDB/0.76"}]
[Thu, 21 Jun 2012 15:19:31 GMT] [debug] [<0.6660.0>] OAuth Params: []
[Thu, 21 Jun 2012 15:19:31 GMT] [debug] [<0.6660.0>] Not a reader: UserCtx {user_ctx,null,[],undefined} vs Names [] Roles [<<"_admin">>,<<"mydb_reader">>]
@pulkitsinghal
pulkitsinghal / gist:2966533
Created June 21, 2012 15:41
AuthN is not really being used by TouchDB, you just think it is, fix this
#pragma mark - SYNC Methods for TouchDB & IrisCouch
- (void) updateSyncURL
{
if (!self.database) {
return;
}
NSURL* remoteURL = [NSURL URLWithString:@"https://mydomain.iriscouch.com/mydb"];
NSArray* repls = [self.database replicateWithURL:remoteURL exclusively:YES];
_pull = [repls objectAtIndex: 0];
_push = [repls objectAtIndex: 1];
2012-06-21 22:13:13.916 MyApp[30547:15b03] awakeFromNib
2012-06-21 22:13:14.077 MyApp[30547:15b03] Creating CouchTouchDBServer at /Users/pulkitsinghal/Library/Application Support/iPhone Simulator/5.1/Applications/473213A0-74F7-4E9B-A868-EB6326006F01/Library/Application Support/TouchDB
22:13:14.079| Logging mode 2 enabled in domains: {RemoteRequest}
2012-06-21 22:13:14.079 MyApp[30547:15b03] Creating database...
22:13:14.103| RemoteRequest: TDRemoteJSONRequest[GET https://mydomain.iriscouch.com/my_db/_local/3eb1c1e3df111486a307de430e1acda7a60ffa68]: Starting...
22:13:14.105| RemoteRequest: TDRemoteJSONRequest[GET https://mydomain.iriscouch.com/my_db/_local/433b721ef57cc8f85556566ec76cbc296fea2df9]: Starting...
22:13:14.105| callback!
22:13:14.106| callback!
2012-06-21 22:13:14.111 MyApp[30547:15b03] ...Created CouchDatabase at <touchdb:///my_db>
2012-06-21 22:13:14.112 MyApp[30547:15b03] UUID exists in userDefaults:org.couchdb.user:3a49c8d6c2b197b31b6b1fde2b03ad64
@pulkitsinghal
pulkitsinghal / gist:3014312
Created June 28, 2012 22:11
Never Ending RKRequestQueue
2012-06-28 17:02:15.013 MyApp[41444:15b03] T restkit.network:RKRequest.m:402 Prepared POST URLRequest '<NSMutableURLRequest http://localhost:9200/myindex/_search -- http://localhost:9200/myindex -- http://localhost:9200/myindex>'. HTTP Headers: {
Accept = "application/json";
"Content-Length" = 135;
"Content-Type" = "application/json";
}. HTTP Body: {"fields":["_id","_rev","name"],"size":2,"query":{"query_string":{"use_dis_max":true,"query":"Green goop","fields":["name"]}},"from":0}.
2012-06-28 17:02:15.013 MyApp[41444:15b03] T restkit.network.queue:RKRequestQueue.m:248 Timer initialized with delay 0.300000 for queue <RKRequestQueue: 0x8b724e0 name=(null) suspended=NO requestCount=1 loadingCount=1/5>
2012-06-28 17:02:15.014 MyApp[41444:15b03] D restkit.network:RKResponse.m:188 Proceeding with request to <NSURLRequest http://localhost:9200/my_index/_search>
2012-06-28 17:02:15.314 MyApp[41444:15b03] T restkit.network.queue:RKRequestQueue.m:248 Timer initialized with delay 0.300000 for queue <RKReque
@pulkitsinghal
pulkitsinghal / gist:3136074
Created July 18, 2012 13:01
Scan line indicator for ZBar overlays
- (UIView *) loadCameraOverlayView
{
NSString *nibName = @"CameraOverlayView";
NSArray *loadedObjects = [[NSBundle mainBundle] loadNibNamed:nibName owner:nil options:nil];
UIView *overlayView = [loadedObjects lastObject];
overlayView.backgroundColor = [UIColor clearColor];
UIImageView *imageView = (UIImageView*)[overlayView viewWithTag:2];
UIImage *image = [UIImage imageNamed:"red_neon_line_320x10.png"];
import java.util.LinkedList;
/**
* I'm employing this super-hacky class which breaks the Java
* class uppercasing conventions because, I want to get the following JSON:
{
"products":[
{...},
{...}
]