Skip to content

Instantly share code, notes, and snippets.

@imtapps
imtapps / progress.py
Created July 14, 2014 16:25
Show the progress without scrolling
import sys
import time
for i in range(100):
sys.stderr.write('\r')
sys.stderr.write(str(i))
time.sleep(.01)
@imtapps
imtapps / .vimrc
Last active August 29, 2015 14:01
Resize Panes in Vim with this config using arrow keys
nnoremap <Left> :vertical resize +1<CR>
nnoremap <Right> :vertical resize -1<CR>
nnoremap <Up> :resize +1<CR>
nnoremap <Down> :resize -1<CR>
" Uncommenting the following line breaks the previous lines
" nnoremap <Esc> :nohlsearch<CR>
node_installed = `which npm`
if node_installed.empty?
execute "cd ~ && wget 'http://nodejs.org/dist/v0.10.25/node-v0.10.25-linux-x64.tar.gz'"
execute "cd ~ && tar xvzf node-v0.10.25-linux-x64.tar.gz"
execute "cd ~ && mv node-v0.10.25-linux-x64 nodejs"
execute "cd /usr/bin/ && ln -s ~/nodejs/bin/node /usr/bin/node"
execute "cd /usr/bin/ && ln -s ~/nodejs/bin/npm /usr/bin/npm"
end
<!DOCTYPE html>
<html>
<head>
<title>Media Query Example</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="main-content">
<div class="container">
@imtapps
imtapps / gist:9055924
Created February 17, 2014 18:10
Format an XML file in vim
:read !xmllint --format %
class DummyMeta(type):
@property
def thing1(self):
return "in thing1"
class Dummy(object):
__metaclass__ = DummyMeta
# thing1 = 'asldfkj'
@imtapps
imtapps / analyze.sh
Created January 15, 2014 19:55
Build Tree of dependencies between projects
#!/bin/bash
DONE=()
WORKING=`pwd`
@imtapps
imtapps / gist:5885324
Created June 28, 2013 14:59
Search commits from a date to find any migrations
git log --stat --summary --since=2013-06-01 | grep "|" | cut -d "|" -f 1 | sort -u | grep migration
cat ~/.ssh/_config | grep -v 'github' | awk '/^Host/ { if($2 !~ /\*/) print $2;}' | xargs -I host ssh host 'cat /etc/motd'
@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){