Skip to content

Instantly share code, notes, and snippets.

@kidpixo
kidpixo / checklist.fish
Last active August 29, 2015 14:15
This script search for all the lines beginning with '- [X] ' in all the files in a directory, where [X] could be [ ]/[-]/[-]
#!/opt/local/bin/fish
##########################################
# requires ag installed, optionally could
# be adapted to grep for a fewfiles
##########################################
# This script search for all the lines beginning with '- [X] ' in all the files in a directory, where [X] could be:
#[ ] = open item
#[x] = closed item
#[-] = ongoing item
#[?] = question item
@kidpixo
kidpixo / fswatch_checklist
Created February 12, 2015 10:30
Simple fswatch-er to trigger the checklist each time a file change (for check_list_simplenote see gist https://gist.github.com/kidpixo/9df8fc3298dfe84dc176)
fswatch -rx $checklist_path | while read event
set actual_pane_width (tmux list-panes | grep '(active)' | sed 's/^.: \[\(.*\)x.*/\1/')
# actual_pane_width + 11 take in account invisible ASCII escape characters
# used for color in check_list_simplenote
check_list_simplenote | cut -c 1-(echo $actual_pane_width"+11" | bc)
repeat = $actual_pane_width
repeat \n 5
end
@kidpixo
kidpixo / tmux_list_all_panes.fish
Created February 12, 2015 12:56
List hierarchically all window and panes in the input tmux session
# list all panes in the session specified in input
function tmux_list_all_panes
if not set -q $argv
echo $argv
for el in (tmux list-windows -t $argv)
echo " "$el
for elem in (tmux list-pane -t $argv:(echo $el | cut -d":" -f 1))
echo " "$elem
end
end
@kidpixo
kidpixo / toc.js
Created February 18, 2015 09:25
ipython extension for ToC, adapted from https://github.com/minrk/ipython_extensions to work with ipython 2.4.0
/*
Add this file and neighboring toc.css to $(ipython locate)/nbextensions/
And load it with:
require(["nbextensions/toc"], function (toc) {
console.log('Table of Contents extension loaded');
toc.load_ipython_extension();
// If you want to load the toc by default, add:
// $([IPython.events]).on("notebook_loaded.Notebook", toc.table_of_contents);
# set opacity of blayer 0 and redraw
def setopacity(layer,opacity):
layer.renderer().setOpacity(opacity)
layer.triggerRepaint()
# Load some basic configuration
# %load https://gist.githubusercontent.com/kidpixo/2ec078d09834b5aa7869/raw/c8812811211dc7cd62f5b530b51b0104f39263ff/ipython%20inizialization
#import pandas as pd
#import numpy as np
%matplotlib qt4
@kidpixo
kidpixo / home.html
Created May 21, 2015 12:54
Social code in geekcookies
<!-- Replace subject with your message using URL Endocding: http://meyerweb.com/eric/tools/dencoder/ -->
<a href="https://mail.google.com/mail/?view=cm&amp;fs=1&amp;tf=1&amp;to=&amp;su=Vieni%20a%20vedere%20%22Episodio+6+-+Audio+in+4k%22%20su%20GeekCookies%20Podcast&amp;body=http%3A%2F%2Fgeekcookies.github.io%2Fpodcast%2F2015%2F04%2F26%2Fepisodio-6%2F" target="_blank"></a>
<a href="https://www.facebook.com/sharer/sharer.php?u=http://geekcookies.github.io/podcast/2015/04/26/episodio-6/" class="popup"></a>
<a href="http://twitter.com/home?status=Vieni%20a%20vedere%20%22Episodio+6+-+Audio+in+4k%22%20su%20GeekCookies%20Podcasti%20http%3A%2F%2Fgeekcookies.github.io%2Fpodcast%2F2015%2F04%2F26%2Fepisodio-6%2F" class="popup"></a>
<a href="http://www.reddit.com/submit?url=http://geekcookies.github.io/podcast/2015/04/26/episodio-6/"></a>
<a href="https://plus.google.com/share?url=Vieni%20a%20vedere%20%22Episodio+6+-+Audio+in+4k%22%20su%20GeekCookies%20Podcasti%20http%3A%2F%2Fgeekcookies.github.io%2Fpodcast%2F2015%2F04%2
@kidpixo
kidpixo / link_list.md
Created June 17, 2015 09:25
List of tools/pages/discussions related/interesting/useful for OpenPlanetary.
# see http://stackoverflow.com/a/20642478/1435167
import numpy as np
from scipy.signal import argrelextrema
x = np.random.random(100)
# for local maxima
argrelextrema(x, np.greater)
# for local minima
@kidpixo
kidpixo / get-to_git-to.py
Created August 7, 2015 11:55
No Description
# ipythonic way
commits_list = ! git --no-pager log --reverse --oneline
commits = []
for i in commits_list:
sha1 = i.split(' ')[0]
print 'Commit SHA-1 value:',sha1
commits.append(sha1)
# pythonic way
path = '/Users/damo_ma/Downloads/github_rep/git_history_visualizer'
builds = pd.DataFrame.from_csv(url,parse_dates=['StartedAt', 'FinishedAt'],index_col=9)
# quick and dirty
builds.groupby(builds.index.week).State.value_counts()
29 passed 4
31 failed 4
35 errored 3
failed 3