Skip to content

Instantly share code, notes, and snippets.

View wblondel's full-sized avatar
🏠
Working from home

William Gérald Blondel wblondel

🏠
Working from home
View GitHub Profile
@wblondel
wblondel / csv_splitter.py
Created December 1, 2023 13:17
Split a large CSV file into smaller files, keeping the header in each file
import csv
import argparse
def split_file(input_file_path, entries_per_file, output_prefix):
with open(input_file_path, 'r') as input_file:
reader = csv.reader(input_file, delimiter=';', quotechar='"')
headers = next(reader, None)
file_count = 1
@wblondel
wblondel / version-check-lfs-10.1.sh
Created March 11, 2021 02:50
Check Host System Requirements for LFS 10.1
#!/bin/bash
# Simple script to list version numbers of critical development tools
export LC_ALL=C
bash --version | head -n1 | cut -d" " -f2-4
MYSH=$(readlink -f /bin/sh)
echo "/bin/sh -> $MYSH"
echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash"
unset MYSH
echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
@wblondel
wblondel / helloworld.emojic
Created March 7, 2016 22:37
"Hello World!" in Emojicode
🐇 🐼 🍇
🐇🐖 🏁 ➡️ 🚂 🍇
😀 🔤Hello world!🔤
🍎 0
🍉
🍉
@wblondel
wblondel / graph.sh
Last active September 18, 2019 14:31 — forked from nicolasazrak/README.md
Graph process memory
#!/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)

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 / check_python_version.py
Created August 14, 2017 05:29
Check Python version at runtime
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 July 5, 2016 22:25
Get number closest to a given value
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:
// 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 / rgb2hex.py
Last active March 6, 2016 08:49
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.
# 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"
Verifying that +wgblondel is my blockchain ID. https://onename.com/wgblondel