Skip to content

Instantly share code, notes, and snippets.

View lw's full-sized avatar

Luca Wehrstedt lw

View GitHub Profile
Test executor: ['/opt/conda/bin/python']
Running distributed/rpc/tensorpipe/test_dist_autograd_spawn ... [2020-06-17 10:01:31.480372]
Running tests...
----------------------------------------------------------------------
V0617 10:01:33.548001 11988 /var/lib/jenkins/workspace/third_party/tensorpipe/tensorpipe/core/context.cc:118] Context 11988:c0 created
V0617 10:01:33.548062 11988 /var/lib/jenkins/workspace/third_party/tensorpipe/tensorpipe/core/context.cc:120] Context 11988:c0 aliased as worker0
V0617 10:01:33.558348 11990 /var/lib/jenkins/workspace/third_party/tensorpipe/tensorpipe/core/context.cc:118] Context 11990:c0 created
V0617 10:01:33.558446 11991 /var/lib/jenkins/workspace/third_party/tensorpipe/tensorpipe/core/context.cc:118] Context 11991:c0 created
V0617 10:01:33.558470 11991 /var/lib/jenkins/workspace/third_party/tensorpipe/tensorpipe/core/context.cc:120] Context 11991:c0 aliased as worker3
@lw
lw / main.py
Last active August 16, 2019 16:38
Asynchronous server using generators
"""Demo asynchronous server using only generators.
Test with:
$ netcat -N 127.0.0.1 1234
"""
import enum
import select
import socket
@lw
lw / recover.sh
Last active February 9, 2019 14:44
Recover files from the Duplicity backup
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""
export PASSPHRASE=""
export DEST="s3://s3.eu-west-3.amazonaws.com/backup-luca-wehrstedt/evron"
duplicity restore --file-to-restore /home/luca/Bilancio/bilancio.gnucash --s3-use-new-style --s3-european-buckets $DEST bilancio.gnucach
@lw
lw / bezier_calc.py
Created September 6, 2018 09:41
Utils from my M1 internship to draw Bezier curves in LaTeX. Find the coordinate of a point along a curve given by its TikZ parameters, split a curve in two at a given point, find the best curve for an arc.
import math
fixed = 0.552284749831 / math.sqrt(2)
fixed = 0.3915
print(fixed)
def get_point_along_bezier(p1, p2, r, out_d, in_d, rel, out_l, in_l, t):
dx = p2[0] - p1[0]
dy = p2[1] - p1[1]
@lw
lw / run_stress_test.sh
Created January 29, 2018 12:18
CMS stress test
./scripts/cmsDropDB -y > /dev/null;
./scripts/cmsInitDB > /dev/null;
./cmscontrib/AddAdmin.py admin -p admin > /dev/null
# -w is the number of workers (there need to be enough already listed in cms.conf).
# -s is the number of submissions, each of 50 (?) testcases.
# also, in Worker.__init__ set fake_time to 0.1.
python cmstestsuite/RunTimeTest.py -w 16 -s 10
@lw
lw / kahn.ml
Created May 7, 2015 16:17
Projet SysRes
module type S = sig
type 'a process
type 'a in_port
type 'a out_port
val new_channel: unit -> 'a in_port * 'a out_port
val put: 'a -> 'a out_port -> unit process
val get: 'a in_port -> 'a process
val doco: unit process list -> unit process
val return: 'a -> 'a process
@lw
lw / snake.py
Created August 6, 2014 10:56
Snake
import sys
import random
import pygame
pygame.init()
grid = (39, 29)
cell = (20, 20)
width = grid[0] * cell[0]
height = grid[1] * cell[1]
import re
def camelcase_to_underscore(name):
return "_".join(w.lower() for w in re.findall("(?:[A-Z][a-z]+|[A-Z]+(?:$|(?=[A-Z][a-z])))", name))
#!/usr/bin/env python3
import argparse
import random
def genera_codice():
result = ""
c1 = random.randint(1, 3);
for i in range(c1):
#!/usr/bin/env python3
import sys
import time
import urllib.request
import hashlib
import subprocess
url = sys.argv[1]