Skip to content

Instantly share code, notes, and snippets.

@imtapps
imtapps / remove.sh
Created April 27, 2012 14:32
Delete all files that have no extenions
ls -aF | grep \*$ | grep -v '\.' | sed s/.$// | xargs rm
@imtapps
imtapps / tests.py
Created August 29, 2012 16:57
REST Kata
import unittest
from urllib import urlencode
from webob import Request
import json
END_POINT = 'http://localhost:8000/person/'
def create_user(name):
request = Request.blank(END_POINT)
request.method = 'POST'
@imtapps
imtapps / .bashrc
Created September 20, 2012 17:53
Add node modules stuff to path in current shell
workon_node_env() {
current_dir=`pwd`
if [ -d "node_modules" ]; then
export ORIGINAL_PATH=$PATH
for f in `ls ${current_dir}/node_modules/`
do.
export PATH="${PATH}:${current_dir}/node_modules/${f}/bin"
done
deactivatenode(){
export PATH=$ORIGINAL_PATH
@imtapps
imtapps / README
Created November 2, 2012 14:58
Celery & Rabbitmq Commands
Run celery_status.sh in a shell, this will display (real time) the current running celery processes.
Try to kill celery using the "rake celery:kill" task and watch to see if they go away, if they do not, you may have to resort to using "kill -9" on specific pids.
Use the "rake rabbitmq:qs" to see how many requests are in each queue in rabbitmq. If there are 60+ in the error queue run the "clear_rabbitmq_queue.py" file to clear them out.
@imtapps
imtapps / bookmarklet
Created November 2, 2012 21:10
Add New Relic to Google Analytics
javascript:var element1 = document.createElement('script');element1.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js';element1.type='text/javascript';document.getElementsByTagName('head')[0].appendChild(element1);var div = document.getElementById('ID-navPanelContainer').style; if(div) void(div.display=(div.display=='none')? 'block':'none');var div = document.getElementById('ID-reportTitle').style; if(div) void(div.display=(div.display=='none')? 'block':'none');var div = document.getElementById('ID-headerPanel').style; if(div) void(div.display=(div.display=='none')? 'block':'none');var div = document.getElementById('ID-overviewPanelTrafficSourceValueOrganicTable').style; if(div) void(div.display=(div.display=='none')? 'block':'none');var div = document.getElementById('ID-overviewPanelGeoComponent').style; if(div) void(div.display=(div.display=='none')? 'block':'none');var div = document.getElementById('ID-footerPanel').style; if(div) void(div.display=(div.display=='none')? 'block':'none'
@imtapps
imtapps / run.sh
Created November 15, 2012 16:34
Delete every XPT file
ls -l /loki/APPS*/INQ/*.XPT --format=commas | sed 's/[ \t\v\f]//g' | perl -pe 's/,(?!\n)/\n/g' | sed 's/,//g' | xargs rm
@imtapps
imtapps / bookmarket.js
Created November 15, 2012 18:33
Add New Relic to Google Analytics - Tmp
javascript:var element1 = document.createElement('script');element1.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js';element1.type='text/javascript';document.getElementsByTagName('head')[0].appendChild(element1);var div = document.getElementById('ID-navPanelContainer').style; if(div) void(div.display=(div.display=='none')? 'block':'none');var div = document.getElementById('ID-reportTitle').style; if(div) void(div.display=(div.display=='none')? 'block':'none');var div = document.getElementById('ID-headerPanel').style; if(div) void(div.display=(div.display=='none')? 'block':'none');var div = document.getElementById('ID-overviewPanelTrafficSourceValueOrganicTable').style; if(div) void(div.display=(div.display=='none')? 'block':'none');var div = document.getElementById('ID-overviewPanelGeoComponent').style; if(div) void(div.display=(div.display=='none')? 'block':'none');var div = document.getElementById('ID-footerPanel').style; if(div) void(div.display=(div.display=='none')? 'block':'none'
import sys
filenam = sys.argv[-1]
phile = filenam[filenam.rindex('/')+1:].replace('.handlebars', '')
with open(filenam, 'r') as inpt:
allstuff = inpt.read()
superx = "".join(allstuff)
@imtapps
imtapps / start.bat
Created February 26, 2013 17:24
Selenium server hub and nodes
java -jar selenium-server-standalone-2.30.0.jar -role hub
java -jar selenium-server-standalone-2.30.0.jar -role node -hub "http://192.168.15.175:4444/grid/register" -browser "browserName=ie8" -browser "browserName=firefox"
java -jar selenium-server-standalone-2.30.0.jar -role node -hub "http://192.168.15.175:4444/grid/register" -browser "browserName=ie9" -browser "browserName=chrome"
@imtapps
imtapps / gist:5292838
Last active December 15, 2015 16:59
MongoDB update queries
//rename collection from fs to attachments
db.fs.files.renameCollection('attachments.files')
db.fs.chunks.renameCollection('attachments.chunks')
//move the tags 'AppendToApplication' and 'AgentDownload' to meta_tags
db.attachments.files.find({tags: {$exists: true}, meta_tags: {$exists: true}}).forEach(function (e) {
var meta_tags = [];
if(e.tags.forEach){