Skip to content

Instantly share code, notes, and snippets.

View lucaswiman's full-sized avatar

[object Object] lucaswiman

View GitHub Profile
@lucaswiman
lucaswiman / .sh
Created June 10, 2017 00:18
grep co-occurrences
function git-co-occurrences() {
pattern1="$1"
pattern2="$2"
comm -12 <(git grep -E "$pattern1" | cut -d ':' -f1 | sort | uniq) <(git grep -E "$pattern2" | cut -d ':' -f1 | sort | uniq)
}
@lucaswiman
lucaswiman / Ties+regular+expression.ipynb
Created March 11, 2017 20:22
Playing with a regular language for tying ties.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get -y install apt-utils
RUN apt-get -y install git
RUN git clone https://github.com/pygraphviz/pygraphviz.git /root/pygraphviz
RUN apt-get -y install build-essential
RUN apt-get -y install python
RUN apt-get -y install python-dev
RUN apt-get -y install python-setuptools
RUN apt-get -y install autoconf
@lucaswiman
lucaswiman / bubble-generator.tcl
Created February 4, 2017 18:53
sqlite syntax diagrams
canvas .c -bg white
# Graphs:
#
set all_graphs {
sql-stmt-list {
toploop {optx sql-stmt} ;
}
sql-stmt {
line
rm *.png; /usr/local/bin/gs -sDEVICE=png16m -r600 -o page-%03d.png example.pdf
\c foo
DROP TABLE IF EXISTS child; DROP TABLE IF EXISTS parent;
CREATE TABLE parent (
parent_id int PRIMARY KEY
);
CREATE TABLE child (
child_id int PRIMARY KEY,
parent_id int REFERENCES parent(parent_id),
function show-history() {
prevbranch="$(git rev-parse --abbrev-ref HEAD)"
echo $prevbranch
newbranch="$1"
echo $newbranch
echo "$newbranch = {"
for sha1 in $(git rev-list $newbranch) ; do
git checkout $sha1 &> /dev/null
echo " '$(git ls-files | sort | xargs sha1sum | sha1sum | cut -d' ' -f1)' : '$sha1',"
done
@lucaswiman
lucaswiman / tox.ini
Last active December 20, 2016 00:52
pylint checking for python 3 compatibility
pylint counsyl/product --py3k --disable=no-absolute-import
git fetch origin -p && git branch -a --merged remotes/origin/master | grep -v master | grep "remotes/origin/" | cut -d "/" -f 3 | xargs -n 1 --max-procs=4 echo git push --delete origin
@lucaswiman
lucaswiman / __radd__.py
Created November 7, 2016 22:02
Python operator overloading example
from __future__ import unicode_literals, print_function
class Add(str):
def __add__(self, other):
print('__add__')
return super(Add, self).__add__(other)
class Radd(str):
def __radd__(self, other):