Skip to content

Instantly share code, notes, and snippets.

@yoyonel
yoyonel / DocString - Algorithmie - carré latin.md
Last active March 30, 2021 07:26
Étude algorithmique et résolution en Python d'un problème "carré latin"

Description du problème

Problème de départ

faire 30 arrangements totalement différent de a-z0-9 30 pangrammes, mais avec aucun indice comment genre si dans un il commence par a, les 29 autres ne commencent pas par a

Reformulé

@yoyonel
yoyonel / index.md
Created November 20, 2020 07:55 — forked from bojand/index.md
gRPC and Load Balancing

Just documenting docs, articles, and discussion related to gRPC and load balancing.

https://github.com/grpc/grpc/blob/master/doc/load-balancing.md

Seems gRPC prefers thin client-side load balancing where a client gets a list of connected clients and a load balancing policy from a "load balancer" and then performs client-side load balancing based on the information. However, this could be useful for traditional load banaling approaches in clound deployments.

https://groups.google.com/forum/#!topic/grpc-io/8s7UHY_Q1po

gRPC "works" in AWS. That is, you can run gRPC services on EC2 nodes and have them connect to other nodes, and everything is fine. If you are using AWS for easy access to hardware then all is fine. What doesn't work is ELB (aka CLB), and ALBs. Neither of these support HTTP/2 (h2c) in a way that gRPC needs.

@yoyonel
yoyonel / timeit_logs_interpolation.ipynb
Created October 18, 2019 15:03
Tests (timeit) on interpolation arguments/lazy evaluations with logs (from logging package)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yoyonel
yoyonel / timeit_logs_interpolation.py
Last active October 18, 2019 15:15
Tests (timeit) on interpolation arguments/lazy evaluations with logs (from logging package)
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("log")
def simple():
if logger.isEnabledFor(logging.DEBUG):
logger.debug(
'Stupid log message ' + ' '.join([str(i) for i in range(20)])
)
@yoyonel
yoyonel / image_write.py
Created July 27, 2019 21:22 — forked from dutc/image_write.py
/proc/self/mem allows arbitrary access to image virtual memory
from os.path import realpath
from sys import executable
from re import compile
from logging import getLogger, basicConfig, INFO
logger = getLogger(__name__)
basicConfig(level=INFO)
#4f2616000-4f2618000 r-xp 00000000 fe:02 3467051 /usr/bin/python3.6
PATTERN = compile('^([0-9a-f]+)-([0-9a-f]+).+$')
@yoyonel
yoyonel / get_file_size_from_url.sh
Last active June 27, 2019 08:41
Get the size of an ISO file from url
#!/bin/bash
# https://stackoverflow.com/questions/2013547/assigning-default-values-to-shell-variables-with-a-single-command-in-bash
DEFAULT_URL=https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/buster_di_alpha5+nonfree/amd64/iso-cd/firmware-buster-DI-alpha5-amd64-netinst.iso
URL=${1:-$DEFAULT_URL}
# https://unix.stackexchange.com/questions/450402/how-to-retrieve-downloadable-file-size-with-curl-command
# https://unix.stackexchange.com/questions/346902/need-to-convert-bytes-to-gb-mb-kb-in-normal-decimal-format
# https://unix.stackexchange.com/questions/44040/a-standard-tool-to-convert-a-byte-count-into-human-kib-mib-etc-like-du-ls1
# http://www.pixelbeat.org/docs/numfmt.html
@yoyonel
yoyonel / salary_range.ipynb
Created June 19, 2019 21:57
Code snippet for generating salary ranges (Functional Programming, Numpy)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yoyonel
yoyonel / encode.sh
Created April 17, 2019 18:46 — forked from mikoim/README.md
YouTube recommended encoding settings on ffmpeg (+ libx264)
#/bin/sh
ffmpeg -i input -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a aac -b:a 384k -profile:a aac_low output
@yoyonel
yoyonel / PYTHON - Chuck Norris - Code Golf.py
Last active November 24, 2020 11:46
PYTHON - Chuck Norris - Code Golf
from itertools import groupby
def chuck_noris_code_gold(message):
map_01 = {'0': '00', '1': '0'}
def string2bits(s=''):
# https://stackoverflow.com/questions/7396849/convert-binary-to-ascii-and-vice-versa
return "".join([