This file contains hidden or 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 | |
import urllib.request,urllib.parse | |
import argparse | |
import json | |
import sys | |
parser = argparse.ArgumentParser() | |
parser.add_argument("--apifile", help="Api file",default="APIKEY.txt") | |
parser.add_argument( "--hostname", help="Host name",default="localhost") |
This file contains hidden or 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
GNU GENERAL PUBLIC LICENSE | |
Version 3, 29 June 2007 | |
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | |
Everyone is permitted to copy and distribute verbatim copies | |
of this license document, but changing it is not allowed. | |
Preamble | |
The GNU General Public License is a free, copyleft license for |
This file contains hidden or 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 re | |
import sys | |
from collections import defaultdict | |
import unicodedata | |
def remove_accents(input_str): | |
nkfd_form = unicodedata.normalize('NFKD', input_str) | |
return "".join([c for c in nkfd_form if not unicodedata.combining(c)]).replace("œ","oe") | |
def magic(text): | |
words = defaultdict(list) |
This file contains hidden or 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
>>> for age,name in itertools.product((21,22,23),("jim","toto")): | |
... print (age,name, (not (age > 22 or name == "jim")) == (age <=22 and name !="jim")) | |
... | |
21 jim True | |
21 toto True | |
22 jim True | |
22 toto True | |
23 jim True | |
23 toto True |
This file contains hidden or 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
#Theoretical exercises in patterns to make API changes smoother | |
from functools import wraps | |
def deprecated_in_favor_of(new_name): | |
def wrap(f): | |
@wraps(f) | |
def wrapped_f(*args, **kwargs): | |
if not wrapped_f._called: | |
print(f.__name__ + ' deprecated in favor of ' + new_name) |
This file contains hidden or 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
; what I have in /emacs.d/init.el | |
(require 'package) | |
(package-initialize) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.milkbox.net/packages/") t) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; what I did to install nimrod-mode | |
; M-x package-install nimrod-mode |
This file contains hidden or 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
20:48:01,813 Pseudo-classe ou pseudo-élément « -webkit-inner-spin-button » inconnu. Jeu de règles ignoré suite à un mauvais sélecteur. app.css:126 | |
20:48:01,813 Pseudo-classe ou pseudo-élément « -webkit-search-cancel-button » inconnu. Jeu de règles ignoré suite à un mauvais sélecteur. app.css:135 | |
20:48:01,813 Propriété « -moz-osx-font-smoothing » inconnue. Déclaration abandonnée. app.css:219 | |
20:48:01,815 Couleur attendue, mais « auto » trouvé. Couleur attendue, mais « -webkit-focus-ring-color » trouvé. Une fin de valeur était attendue, mais « -webkit-focus-ring-color » a été trouvé. Erreur d'analyse de la valeur pour « outline ». Déclaration abandonnée. app.css:855 | |
20:48:01,818 Une fin de valeur était attendue, mais « \9 » a été trouvé. Erreur d'analyse de la valeur pour « margin-top ». Déclaration abandonnée. app.css:1862 | |
20:48:01,818 Couleur attendue, mais « auto » trouvé. Couleur attendue, mais « -webkit-focus-ring-color » trouvé. Une fin de valeur était attendue, mais « -webkit-focus-ring-color |
This file contains hidden or 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 pprint | |
d=[ | |
{ | |
"exchange": "B", | |
"price": { | |
"id": 1, | |
"value": "false" | |
} | |
}, |
This file contains hidden or 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
setup = """ | |
def bitcount (n): | |
c = 0 | |
while n > 0: | |
n, r = divmod(n, 2) | |
c += r | |
return c | |
def fact(size): | |
bc = [bitcount(i) for i in range(2**(size))] |
This file contains hidden or 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 random | |
def f(): | |
total_damage = 0 | |
attack_score = 0 | |
defence_score = 0 | |
enemy_list = list(range(10)) | |
power = 5 | |
unit_size = 2000 | |
enemy_defence = 5 | |
enemy_unit_size = 2000 |
OlderNewer