Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

William Gerald Blondel wblondel

🏠
Working from home
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am wblondel on github.
  • I am wblondel (https://keybase.io/wblondel) on keybase.
  • I have a public key ASDB8JwGwEE1xSlHhRx_yDhOAHavzPAz9L6o-oO0a89GXAo

To claim this, I am signing this object:

@wblondel
wblondel / graph.sh
Last active Sep 18, 2019 — forked from nicolasazrak/README.md
Graph process memory
View graph.sh
#!/bin/sh
# https://stackoverflow.com/questions/7998302/graphing-a-processs-memory-usage
# Usage ./graph.sh <pid>
# It requires having gnuplot installed
# trap ctrl-c and call ctrl_c()
trap ctrl_c INT
LOG=$(mktemp)
@wblondel
wblondel / check_python_version.py
Created Aug 14, 2017
Check Python version at runtime
View check_python_version.py
import sys
def check_installation(rv):
current_version = sys.version_info
if current_version[0] == rv[0] and current_version[1] >= rv[1]:
pass
else:
sys.stderr.write("[%s] - Error: Your Python interpreter must be %d.%d or greater (within major version %d)\n" % (sys.argv[0], rv[0], rv[1], rv[0]) )
sys.exit(-1)
@wblondel
wblondel / takeClosest.py
Created Jul 5, 2016
Get number closest to a given value
View takeClosest.py
from bisect import bisect_left
def takeClosest(myList, myNumber):
"""
Assumes myList is sorted. Returns closest value to myNumber.
If two numbers are equally close, return the smallest number.
"""
pos = bisect_left(myList, myNumber)
if pos == 0:
View nodejs-cheatsheet.js
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@wblondel
wblondel / helloworld.emojic
Created Mar 7, 2016
"Hello World!" in Emojicode
View helloworld.emojic
🐇 🐼 🍇
🐇🐖 🏁 ➡️ 🚂 🍇
😀 🔤Hello world!🔤
🍎 0
🍉
🍉
@wblondel
wblondel / rgb2hex.py
Last active Mar 6, 2016
Provided three int values, this will return a valid hex triplet representing a color. If those values are between [0,255], then it will treat those as RGB values and return the color corresponding to those values.
View rgb2hex.py
# Provided three int values, this will return a valid hex triplet representing a color.
# If those values are between [0,255], then it will treat those as RGB values and return the color corresponding to those values.
# This uses the preferred method of string formatting, as described in PEP 3101.
# It also uses min() and max to ensure that 0 <= {r,g,b} <= 255.
def main():
# Let's say you get the parameters as string
parameter = "130,132,245"
View gist:84506ef335ed1afd3cf9
Verifying that +wgblondel is my blockchain ID. https://onename.com/wgblondel
You can’t perform that action at this time.