Skip to content

Instantly share code, notes, and snippets.

View sebble's full-sized avatar

Sebastian Mellor sebble

  • Sebble.com
  • Newcastle upon Tyne
View GitHub Profile
@sebble
sebble / 00-Introduction.md
Last active October 18, 2015 22:06
SSL Security
@sebble
sebble / progress.py
Last active August 29, 2015 14:11
Really simple (but flexible) python progress bar
import sys
def progress(current, total=1., text='', width=80, fillchar='#', padchar=' ', startchar='[', endchar=']', done='\n'):
if current > total:
raise ValueError('current is greater than total')
if text is not '':
text = text + ': '
@sebble
sebble / .bashrc
Last active August 29, 2015 14:12
.bashrc
alias lsb='echo "$(lsb_release -ds) ($(lsb_release -cs))"'
alias dog='pygmentize -g'
export EDITOR='vim'
@sebble
sebble / parse_csv.py
Created January 21, 2015 11:22
Parse a simple CSV file with a Python one-liner
data = array([line.strip().split(',') for line in open('data.csv')])
@sebble
sebble / 00-setup.sh
Last active August 29, 2015 14:15
Jupyter Kernels
# http://jupyter.cs.brynmawr.edu/hub/dblank/public/Jupyter%20Help.ipynb#1.4.2-Enable-Python-3-kernel
# https://nbviewer.jupyter.org/github/ellisonbg/talk-2014-summer/blob/cfa/Multilanguage.ipynb
## Python 2
sudo apt-get install python-pip libzmq3-dev
sudo pip install -U pip
sudo pip install ipython pyzmq matplotlib
#sudo pip install -I ipython==3.* # force v3
## Python 3
@sebble
sebble / README.md
Last active August 29, 2015 14:16
Distraction Free IPython Notebook

Distraction free writing in IPython notebooks

  • Minimal styles to emphasise writing
  • WYWIWYG markdown editing to improve writing flow

Can we outsource HTML->MD editing to https://jejacks0n.github.io/mercury/documentation/#markdown-region?

Note: IPython notebooks use marked internally, a reverse (HTML->MD converter should match supported marked syntax, IPython configurations, and ignore dynamic IPython features (e.g., heading anchors, MathJax)

IPython features to avoid

@sebble
sebble / vimnote
Created March 25, 2015 08:59
Start Goyo in Vim in terminal with note
mkdir -p '~/Notebooks/Vim' && xfce4-terminal --maximize -x bash -c 'source ~/.bashrc;vim +"norm i$(date -I)^M^M" +Goyo +startinsert "~/Notebooks/Vim/$(date -I)_$(zenity --entry --title="New Note" --text="~/Notebooks/Vim/$(date -I)\_<title>:" --entry-text="new_note")"'
@sebble
sebble / data.csv
Last active August 29, 2015 14:19 — forked from psealock/data.csv
id type amount
01 Restaurant 100
02 Entertainment 100
03 Rent 200
04 Groceries 250
@sebble
sebble / remote_ip.conf
Last active September 11, 2015 03:02
Nginx Remote IP
map $http_user_agent $mode {
default 'plain';
~*(Mozilla) 'html';
}
map $http_user_agent $html {
default '';
~*(Mozilla) '<title>$remote_addr</title>';
}
server {
@sebble
sebble / check-repos.sh
Created October 4, 2015 20:49
Check for changes in all git repos on system
#!/bin/bash
sudo updatedb
for git in `locate -b --regex '^.git$'`; do
cd $git/..;
if git status 2>/dev/null|grep -E '(Untracked|Changes|ahead)'>/dev/null; then
echo Changes in $git;
else
echo None in $git;