This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
pkglst=$(pip list --user --outdated --format=freeze | cut -d= -f1) | |
if [ "$pkglst" = "" ]; then | |
echo "All pip packages is up to date. Nothing to do." | |
exit | |
fi | |
echo -ne "OUTDATED PIP PACKAGES:\n " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def split_n (seq, n=1, allow_partial=True): | |
if not allow_partial and (len(seq) % n != 0): raise RuntimeError() | |
return [seq[i:i+n] for i in range(0,len(seq),n)] | |
""" | |
>>> print (split_n ('abcdefghijklmnopqrstuvwxy', 4)) | |
['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'y'] | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ apt-get install xdotool entr | |
$ find -name \*.css -or -name \*.html | entr -p xdotool key --window $(xdotool selectwindow) F5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef NULL | |
const int NULL = | |
!! ! ! ! ! ! | |
! ! ! ! ! ! ! | |
! !! ! ! ! ! | |
! ! !!!!!! !!!!! !!!!!1; | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur glitter-0.1.7/glitter/contexts/textures.py glitter-0.1.7-python3/glitter/contexts/textures.py | |
--- glitter-0.1.7/glitter/contexts/textures.py 2014-04-11 11:15:21.000000000 +0200 | |
+++ glitter-0.1.7-python3/glitter/contexts/textures.py 2016-11-20 13:15:18.448297416 +0100 | |
@@ -10,12 +10,6 @@ | |
from glitter.utils import BindableObject, GlitterError | |
from glitter.contexts.proxies import BindingProxy | |
-try: | |
- next | |
-except NameError: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def cartesian_product (seq1, seq2): | |
return [a+b for a in seq1 for b in seq2] | |
# A deck of cards | |
deck = cartesian_product ('♠♥♦♣', list('123456789') + ['10'] + list('JQK')) | |
def shuffle_cards (): | |
random.shuffle (deck) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Built-in Higher Order Functions for Array: | |
// map, filter, forEach, some, every, reduce | |
// The Emperor’s New Closure: FP in Javascript | |
// https://www.youtube.com/watch?v=a6azjixVy2g | |
l = [1,2,3,4,5] | |
function is_even(n) { return n%2==0; }; // predicate | |
function larger_than(n) { return function(m) { return m > n; } }; | |
l.reduce(function (a,b) { return a+b; }); // sum(l) |