Skip to content

Instantly share code, notes, and snippets.

View mehdimehdi's full-sized avatar

Mehdi Ait Oufkir mehdimehdi

View GitHub Profile
<script src="http://cdn.wibiya.com/Toolbars/dir_1057/Toolbar_1057521/Loader_1057521.js" type="text/javascript"></script><noscript><a href="http://www.wibiya.com/">Web Toolbar by Wibiya</a></noscript>
mehdi-ait-oufkirs-MacBook-Air:mongo-hadoop mehdi$ echo $CLASSPATH
/Users/mehdi/Documents/mongo-hadoop/examples/wordcount/target/mongo-hadoop-wordcount-example-1.0-SNAPSHOT.jar:
mehdi-ait-oufkirs-MacBook-Air:mongo-hadoop mehdi$ jar tvf examples/wordcount/target/mongo-hadoop-wordcount-example-1.0-SNAPSHOT.jar
0 Sat Jan 21 10:41:52 PST 2012 META-INF/
124 Sat Jan 21 10:41:50 PST 2012 META-INF/MANIFEST.MF
0 Sat Jan 21 10:41:50 PST 2012 com/
0 Sat Jan 21 10:41:50 PST 2012 com/mongodb/
0 Sat Jan 21 10:41:50 PST 2012 com/mongodb/hadoop/
0 Sat Jan 21 10:41:50 PST 2012 com/mongodb/hadoop/examples/
0 Sat Jan 21 10:41:50 PST 2012 com/mongodb/hadoop/examples/wordcount/
hadoop:
type: custom
buildscript: builder
#!/bin/sh
echo 'Checking if Hadoop is already installed...'
if [ -d ~/hadoop ]
then
echo 'Hadoop found.'
else
echo 'Hadoop not found. Installing it...'
wget -O ~/hadoop-0.20.203.0rc1.tar.gz https://s3.amazonaws.com/punchtab-software/hadoop-0.20.203.0rc1.tar.gz
echo 'Hadoop installed.'
@mehdimehdi
mehdimehdi / gist:1691202
Created January 27, 2012 22:12
PunchTab for VM.
<script type="text/javascript" charset="utf-8">
var _ptq = _ptq || [];
var _punchtab_settings = {
key: "1c4c68cc540d00d01dbd8e05aadd2101",
display: "tab",
position: {x:"left", y:"bottom"}
};
(function() {
var pt = document.createElement('script'); pt.type = 'text/javascript'; pt.async = true;
@mehdimehdi
mehdimehdi / gist:2082090
Created March 18, 2012 21:46
appending data to table
from django.db import connections, transaction
cursor = connections['noudata'].cursor()
# Data modifying operation - commit required
cursor.execute("insert into activity (user_id,name,remote_addr,referrer,hostname,points,date_created,_id,publisher_id) select user_id,name,remote_addr,referrer,hostname,points,date_created,_id,publisher_id from bson('s3://punchtab-mongolab-backups/%s');" % file_name)
transaction.commit_unless_managed() #I also tried without the commit
@mehdimehdi
mehdimehdi / gist:2141938
Created March 20, 2012 22:27
restart log
2012-03-20 22:26:13,269 (3606/MainThread) newrelic DEBUG - Initializing Python agent logging.
2012-03-20 22:26:13,270 (3606/MainThread) newrelic DEBUG - Log file "/var/log/supervisor/newrelic-python-agent.log".
2012-03-20 22:26:13,270 (3606/MainThread) newrelic.config DEBUG - agent config log_file = '/var/log/supervisor/newrelic-python-agent.log'
2012-03-20 22:26:13,271 (3606/MainThread) newrelic.config DEBUG - agent config log_level = 10
2012-03-20 22:26:13,271 (3606/MainThread) newrelic.config DEBUG - agent config app_name = 'Test Python application on dotCloud'
2012-03-20 22:26:13,271 (3606/MainThread) newrelic.config DEBUG - agent config license_key = 'cae82c085ff771bbc184bf3c8556e6b4377f72d7'
2012-03-20 22:26:13,271 (3606/MainThread) newrelic.config DEBUG - agent config monitor_mode = True
2012-03-20 22:26:13,271 (3606/MainThread) newrelic.config DEBUG - agent config capture_params = False
2012-03-20 22:26:13,271 (3606/MainThread) newrelic.config DEBUG - agent config ignored_params = []
2012-03-20 22:26:
2012-03-20 22:35:09,568 (3748/MainThread) newrelic DEBUG - Initializing Python agent logging.
2012-03-20 22:35:09,568 (3748/MainThread) newrelic DEBUG - Log file "/var/log/supervisor/newrelic-python-agent.log".
2012-03-20 22:35:09,568 (3748/MainThread) newrelic.config DEBUG - agent config log_file = '/var/log/supervisor/newrelic-python-agent.log'
2012-03-20 22:35:09,568 (3748/MainThread) newrelic.config DEBUG - agent config log_level = 10
2012-03-20 22:35:09,568 (3748/MainThread) newrelic.config DEBUG - agent config app_name = 'Test Python application on dotCloud'
2012-03-20 22:35:09,569 (3748/MainThread) newrelic.config DEBUG - agent config license_key = 'cae82c085ff771bbc184bf3c8556e6b4377f72d7'
2012-03-20 22:35:09,569 (3748/MainThread) newrelic.config DEBUG - agent config monitor_mode = True
2012-03-20 22:35:09,569 (3748/MainThread) newrelic.config DEBUG - agent config capture_params = False
2012-03-20 22:35:09,569 (3748/MainThread) newrelic.config DEBUG - agent config ignored_params = []
2012-03-20 22:35:
@mehdimehdi
mehdimehdi / gist:2279818
Created April 2, 2012 00:54
gzip configuration for nginx.conf
gzip on;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable msie6;
import urllib
import urllib2
import oauth
CONSUMER_KEY = '50B4YwaUeSQvyCaFeI3TRg'
CONSUMER_SECRET = 'XXXX'
RESOURCE_URL = 'https://punchtab.uservoice.com/api/v1/tickets.json'
# Setup 2 legged OAuth consumer based on our admin "credentials"
consumer = oauth.OAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET)