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
# Custom service file to start a network interface to route to an other | |
# | |
# Use systemd from ArchLinux | |
# To install : | |
# Place this file in /etc/systemd/system with a chmod of 644 and root:root as | |
# owner. A configuration file is also required at /etc/conf.d/router.conf | |
# which contains some variable declarations. | |
# | |
# To start : | |
# # systemctl start router.service |
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 exo1(): | |
ls = set([raw_input() for _ in xrange(int(raw_input()))]) | |
print '\n'.join(['oui' if raw_input() in ls else 'non' for _ in xrange(int(raw_input()))]) | |
#exo1() | |
def exo2(): | |
def dist(x1, y1, x2, y2): | |
return abs(x1 - x2) + abs(y1 - y2) | |
pos_o, pos_f = None, 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
from PIL import Image | |
import numpy as np | |
def image2array(filname): | |
return np.array(Image.open(filename)) |
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
# Point : nametuple x : Real, y : Real, db: Real, de: Real, parent : Point | |
# db: real distance from the beginning | |
# de : heuristic distance from the end | |
def a_star(B, E, D, H, N): | |
""" | |
B : begin Point | |
E : end Point | |
D : distance (Point, Point) -> Real | |
H : heuristic distance (Point, Point) -> Real |
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 scipy.misc import imread, imsave | |
from scipy import ndimage | |
import numpy as np | |
import math | |
def circle(radius): | |
""" Product a boolean array with a shape of circle inside (True inside the | |
circle and False outside). """ | |
assert radius >= 1 | |
radius -= 1 |
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 math | |
import numpy as np | |
import bisect | |
from heapq import * | |
def a_star(B, E, D, H, N): | |
""" | |
B : begin Point | |
E : end Point | |
D : distance (Point, Point) -> Real |
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
allInstruments.stream() | |
.filter(missingCross) | |
.flatMap(instrument -> Stream.of(instrument.getCurrency(), instrument.getBaseCurrency())) | |
.filter(cur -> cur != refCurrency) | |
.map(cur -> Forex.create(refCurrency, cur)) | |
.filter(not(allInstruments::contains)) | |
.iterator(); |
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
public class TrackingCommandsExecutor implements Executor { | |
private final Queue<CountDownLatch> commandLatches = new ConcurrentLinkedQueue<>(); | |
private final Executor delegate; | |
public TrackingCommandsExecutor(Executor delegate) { | |
this.delegate = delegate; | |
} | |
@Override |
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
// Lib build file | |
android { | |
buildTypes { | |
release { | |
minifyEnabled true | |
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |
} | |
} | |
} |
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
# Command: | |
adb shell am instrument -w -e class com.banno.android.gordontest.ParameterizedTest#parameterizedB -r -e debug false com.banno.android.gordontest.test/androidx.test.runner.AndroidJUnitRunner | |
# Output: | |
INSTRUMENTATION_STATUS: class=com.banno.android.gordontest.ParameterizedTest | |
INSTRUMENTATION_STATUS: current=1 | |
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner | |
INSTRUMENTATION_STATUS: numtests=2 | |
INSTRUMENTATION_STATUS: stream= | |
com.banno.android.gordontest.ParameterizedTest: |
OlderNewer