Skip to content

Instantly share code, notes, and snippets.

David Fischer davidfischer-ch

Block or report user

Report or block davidfischer-ch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@davidfischer-ch
davidfischer-ch / french.py
Created Mar 26, 2020
French Dictionary Statistics
View french.py
#!/usr/bin/env python3
"""
We want to buy magnetic letters to teach French at home during the COVID-19 crisis.
I was wondering what is the optimal bag of letters to be able to *write* French words.
This script implements two ways of estimating this, *optimal bag of letters*:
- Per word max occurrence of each letters (ensure the bare minimum to write any single word of the dictionary [1])
- Statistical occurrence of letters (biased as words frequency is strongly dependent of the context [2])
View string_converter.py
#!/usr/bin/env python
"""
Convert camel-case to snake-case in python.
e.g.: CamelCase -> snake_case
e.g.: snake_case -> CamelCase
e.g.: CamelCase -> dash-case
e.g.: dash-case -> CamelCase
By: Jay Taylor [@jtaylor]
Me<modifier>: Yahya Kacem <fuj.tyoli@gmail.com>
Original gist: https://gist.github.com/jaytaylor/3660565
View human_log.py
FIELDS = ['cmd', 'command', 'start', 'end', 'delta', 'msg', 'stdout', 'stderr']
def human_log(res):
if isinstance(res, dict):
for field in FIELDS:
if field in res.keys():
encoded_field = res[field].encode('utf-8')
print '\n{0}:\n{1}'.format(field, encoded_field)
You can’t perform that action at this time.