This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias dockershell="docker run --rm -i -t --entrypoint=/bin/bash" | |
alias dockershellsh="docker run --rm -i -t --entrypoint=/bin/sh" | |
function dockershellhere() { | |
dirname=${PWD##_/} | |
docker run --rm -it --entrypoint=/bin/bash -v `pwd`:/${dirname} -w /${dirname} "$@" | |
} | |
function dockershellshhere() { | |
dirname=${PWD##_/} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
smbservehere() { | |
local sharename | |
[[ -z $1 ]] && sharename="SHARE" || sharename=$1 | |
docker run --rm -it -p 445:445 -v "${PWD}:/tmp/serve" rflathers/impacket smbserver.py -smb2support $sharename /tmp/serve | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def iterate(iterable, n): | |
first = [] | |
for second in iterable: | |
first.append(second) | |
if len(first) == n: | |
yield first | |
first.pop(0) | |
yield first | |
def main(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
atom-ide-ui | |
busy-signal | |
ide-python | |
intentions | |
language-latex | |
keybinding-cheatsheet | |
latex | |
markdown-preview-enhanced | |
minimap | |
pdf-view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
def while_true(func): | |
""" Décore la fonction d'une boucle while True pour les inputs. | |
On peut tester ses propres exceptions. | |
""" | |
@functools.wraps(func) | |
def wrapper(*args, **kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
def setup_custom_logger(name, here): | |
"""Création d'un logger. | |
On veut logger dans le terminal (ERROR) et dans un fichier de log (DEBUG). | |
Debug (logger.debug): Provide very detailed output. Used for diagnosing | |
problems. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import perf_counter_ns | |
from random import randint | |
def bench(preparation, a_mesurer, repetitions=30): | |
temps = [] | |
for _ in range(repetitions): | |
entree = preparation() | |
debut = perf_counter_ns() | |
a_mesurer(entree) | |
fin = perf_counter_ns() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
: ' | |
VINCENT Nicolas | |
Utilisation de cProfile pour créer un fichier .prof puis affichage du fichier avec snakeviz. | |
USAGE: | |
bash performances.sh pyhack.py perf.prof | |
' | |
echo $(python3 --version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from more_itertools import ilen | |
def nombre_occurrences(liste, element): | |
return ilen(filter(lambda el: el == element, liste)) | |
def element_maj(liste): | |
return next(filter(lambda element: nombre_occurrences(liste, element) > len(liste)//2, liste), None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
inversion_counting.py : compte le nombre d'inversion à effectuer pour trier une séquence | |
""" | |
from empirical_complexity import empirical_complexity |
OlderNewer