Skip to content

Instantly share code, notes, and snippets.

View pgreze's full-sized avatar

Pierrick Greze pgreze

View GitHub Profile
@pgreze
pgreze / japanesepod101-show-vocab.js
Last active May 11, 2017 07:51
Japanese websites scripts
// ==UserScript==
// @name Display pronounciation for all vocabulary
// @namespace https://www.japanesepod101.com/2007/05/24/lower-intermediate-25-tempura-tantrum/
// @version 0.1
// @description Display pronounciation for all vocabulary
// @license GNU Lesser General Public License (LGPL)
// @author pgreze
// @copyright pgreze, GNU Lesser General Public License (LGPL)
// @include https://japanesepod101.com/*
// @include https://www.japanesepod101.com/*
@pgreze
pgreze / binary.py
Created December 16, 2015 00:02
Binary operations with Python
>>> def show(i): print(''.join(("1" if i & mask else "0") for mask in (0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01)))
...
>>> show(0x40)
01000000
>>> show(1)
00000001
>>> show(24)
00011000
>>> show(ord('a'))
01100001
@pgreze
pgreze / skyline.py
Created December 15, 2015 23:54
Skyline solutions
#!/usr/bin/env python3
"""Skyline solutions.
See https://pykello.github.io/programming/2015/12/12/haskell-skyline/
Bench with ipython:
%timeit -r 10 skyline.skyline1(skyline.buildings)
10000 loops, best of 10: 19.6 µs per loop