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] | |
cln = !git fetch --prune && git branch --verbose | grep gone | awk '{ print $1 }' | xargs -r git branch -D | |
fall = !for b in $(git branch -l --format "%(refname:lstrip=2)"); do git fetch origin $b:$b; done | |
st = status -s | |
cl = clone | |
ci = commit | |
co = checkout | |
br = branch | |
r = reset | |
cp = cherry-pick |
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
__author__ = 'davide' | |
import collections | |
class Element: | |
def __init__(self, parent, rank=0, size=1): | |
self.parent = parent | |
self.rank = rank | |
self.size = size |
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
__author__ = 'davide' | |
from collections import namedtuple, deque | |
from random import randint | |
import sys | |
import itertools as it | |
class Rect(namedtuple("_Rect", "x, y, w, h")): | |
def __contains__(self, point): |
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
cell_index(0..8). | |
cell_value(1..9). | |
% fill with initial values | |
initial_pos(0, 3, 4). | |
initial_pos(0, 6, 1). | |
initial_pos(0, 7, 5). | |
initial_pos(1, 1, 8). | |
initial_pos(1, 2, 1). | |
initial_pos(1, 3, 9). |
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 itertools as it | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from scipy.integrate import odeint | |
mu = 0.3 | |
L = 10 | |
g = 9.8 | |
DELTA = 0.01 | |
T = 1000 |
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
class dyn_bitset | |
{ | |
using byte_t = uint_fast8_t; | |
private: | |
int _size, _bits; | |
byte_t* _buf; | |
public: | |
dyn_bitset(int n) |
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
module Main where | |
import Data.Char | |
import Control.Monad | |
import System.IO | |
type Token = (String, Bool) | |
mySplit :: (Char -> Bool) -> String -> [Token] | |
mySplit _ "" = [] |
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
(define factor | |
(lambda (n) | |
(let ([next (lambda (i) | |
(if (zero? (modulo i 2)) | |
(1+ i) | |
(+ 2 i)))]) | |
(let f ([n n] [i 2]) | |
(let ([d (/ n i)] [s (sqrt n)]) | |
(cond | |
[(>= i s) (list n)] |
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
#ifndef BFINTEPRETER_H_ | |
#define BFINTEPRETER_H_ | |
#include <iostream> | |
#include <cstdint> | |
#include <vector> | |
using namespace std; | |
namespace BF |
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
__author__ = 'davide' | |
import operator | |
NO_EFFECT, NOT_EFFECTIVE, NORMAL, SUPEREFFECTIVE = range(4) | |
TYPES = list(zip(['Normale', 'Fuoco', 'Acqua', 'Elettro', 'Erba', 'Ghiaccio', | |
'Lotta', 'Veleno', 'Terra', 'Volante', 'Psico', 'Coleottero', | |
'Roccia', 'Spettro', 'Drago', 'Buio', 'Acciaio'], range(17))) |
NewerOlder