Skip to content

Instantly share code, notes, and snippets.

View pulkitsinghal's full-sized avatar

Pulkit Singhal pulkitsinghal

View GitHub Profile
@pulkitsinghal
pulkitsinghal / compoundKeyDIH.xml
Created November 14, 2011 14:06
Compound primary key for Solr's Data Import Handler (DIH)
<entity name="product" pk="primaryKey" transformer="TemplateTransformer,DateFormatTransformer">
<field column="sku" xpath="/products/product/sku" />
<field column="productId" xpath="/products/product/productId" />
<field column="primaryKey" template="${product.productId}_${product.sku}" />
</entity>
@pulkitsinghal
pulkitsinghal / sampleAmazonRssFeedItem.xml
Created November 14, 2011 14:40
Sample item from the Amazon RSS feed
<item>
<title>Unleashed [Blu-ray/DVD Combo + Digital Copy] (Blu-ray) newly tagged "blu-ray"</title>
<guid isPermaLink="false">A:B004ZJZQ3S|T:blu-ray|D:131597984</guid>
<link>http://www.amazon.com/Unleashed-Blu-ray-Combo-Digital-Copy/dp/B004ZJZQ3S</link>
<pubdate>Wed, 14 Sep 2011 05:57:27 GMT</pubDate>
<description>HTML CHUNK</description>
</item>
@pulkitsinghal
pulkitsinghal / embeddedImageInItemDesc.xml
Created November 14, 2011 14:44
Embedded HTML data inside an Item's description value
<div style="float:left;" class="tgRssImage">
<a class="url" href="...">
<img src="http://ecx.images-amazon.com/images/I/51GmbDm32gL._SL160_SS160_.jpg"
width="160"
alt="Unleashed [Blu-ray/DVD Combo + Digital Copy]"
class="photo"
height="160" border="0">
</a>
</div>
@pulkitsinghal
pulkitsinghal / gist:1365589
Created November 14, 2011 23:36
Ideas for improving GitHub's Gist
<script
src="http://code.jquery.com/jquery-1.6.4.min.js"
type="text/javascript"
charset="utf-8">
</script>
<script
src="https://raw.github.com/iamnoah/writeCapture/master/writeCapture.js"
type="text/javascript"
charset="utf-8">
@pulkitsinghal
pulkitsinghal / gist:1455699
Created December 10, 2011 17:36
Configuring EC2 RHEL4 with Chef
which ruby
ruby -version
port list | grep ruby
sudo gem update --system
gem -v
mkdir -p ~/chef-repo/.chef/
mv ~/Downloads/<chef-hosted-account-username>.pem ~/chef-repo/.chef/
mv ~/Downloads/knife.rb ~/chef-repo/.chef/
mv ~/Downloads/<chef-hosted-organization-name>-validator.pem ~/chef-repo/.chef/
@pulkitsinghal
pulkitsinghal / gist:1470015
Created December 13, 2011 01:47
EC2 Bare Minimum
# For moving data to & from the EC2 instance, simply use scp which runs on top of ssh like so:
$ scp -i /Users/XXX/.ec2/ec2.pem ec2-user@ec2-XXX.compute-1.amazonaws.com:/path/to/file/to/get/from/ec2/instance.txt /path/to/local/folder/for/storage/
$ scp -i /Users/XXX/.ec2/ec2.pem /path/to/file/to/push/to/ec2/instance.txt ec2-user@ec2-XXX.compute-1.amazonaws.com:/path/to/ec2/folder/for/storage/
@pulkitsinghal
pulkitsinghal / gist:1481376
Created December 15, 2011 14:56
Move Git repository from Unfuddle to BitBucket
mkdir temp
cd temp
git clone git@yourDomain.unfuddle.com:yourDomain/yourRepoName.git
cd yourRepoName/
git remote rm origin
git remote add origin https://yourUsername@bitbucket.org/yourUsername/yourNewRepoName.git
git remote show origin
git push origin master
cd ../..
rm -rf temp
@pulkitsinghal
pulkitsinghal / gist:1932711
Created February 28, 2012 13:59
Ramping Up on ElasticSearch Query DSL
// 1) Lets start with the simplest query that you can run in
// the head plugin for ElasticSearch located at the url:
// http://localhost:9200/_plugin/head/
{
"query": {
"match_all": {}
}
}
// 2) Before jumping into forming queries with the ES Query DSL
...
#import "CouchCocoa.h"
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
/* Try to connect to the IrisCouch instance */
// 1) Create a server object via the URL
NSURL* serverURL = [NSURL URLWithString: @"https://mydomain.iriscouch.com"];
REST: Authentication challenge! credential=<NSURLCredential: 0x857b040>: username