Skip to content

Instantly share code, notes, and snippets.

View sakex's full-sized avatar
🇮🇱

Alexandre Senges sakex

🇮🇱
View GitHub Profile
class Node:
def __init__(self, name, parent):
self.name = name
self.parent = parent
self.children = {}
def addChild(self, childname, weight):
child = Node(childname, self)
self.children[childname] = {
"node": child,
@sakex
sakex / tinder.js
Created February 26, 2018 13:59
One liner script to automatically swipe right every half seconds on tinder web
setInterval(() => {document.getElementsByClassName("recsGamepad__button--like")[0].click()}, 500);
@sakex
sakex / instaUnfollow.js
Created March 4, 2018 13:54
instaUnfollow.js
const getList = () => {
let elems = document.getElementsByClassName("_2nunc");
elems = [...elems];
elems = elems.map(elem => elem.querySelector("a").innerHTML);
elems = new Set(elems);
return elems;
}
// Open followers tab
const followers = getList();
@sakex
sakex / optim.py
Created March 26, 2018 15:24
Optimisation Investissement Business Game
# cap = augmentation de capacité
# (si cap = 1, on a augmenté la capacité de 1000 par heure)
def profit_setup(setup, profit, cost, cap, rounds):
# Quantité produite maximum par jour
dailyQ = (24000.0+cap*1000)
# Quantité vraiment produite avec set up time
Q = dailyQ-setup*dailyQ/24 - 16000
# On estime la dépréciation à 417 par jour par augmentation de capacité
total_depreciation = rounds*417*cap
from financials import valuation
import financials
requested_investment = 5e6
projected_sales_y7 = 20e6
projected_PE = 15
MARR = .5
shares = 5e5
@sakex
sakex / netflix.js
Created October 8, 2018 20:43
Play Netflix at the end of the minute to watch live with a friend
const play = () => {
document.querySelector('video').play();
};
const launch = () => {
const now = new Date(),
delay = 60000 - now % 60000;
setTimeout(play, delay);
}
@sakex
sakex / TT.JS
Created November 16, 2018 18:40
const B1 = account.GBP * EURGBP * USDEUR;
const B2 = account.GBP * GBPUSD;
if (B1 - B2 > 100) {
buy('USDGBP', account.GBP - 1000);
buy('EURUSD', account.USD - 1000);
buy('GPBEUR', account.EUR - 1000);
}
if (B2 - B1 < -100) {
@sakex
sakex / clement_example.py
Created January 6, 2020 15:44
Clément Mihailescu Google mock interview
bounds1 = ('9:00', '20:00')
c1 = [('9:00', '10:30'), ('12:00', '13:00'), ('16:00', '18:00')]
c2 = [('10:00', '11:30'), ('12:30', '14:30'), ('14:30', '15:00'), ('16:00', '17:00')]
bounds2 = ('10:00', '18:30')
def parse_date(date: str):
h, m = map(int,date.split(":"))
return 100*h + m
def parse_period(period):
function forEach(arr, func) {
const len = arr.length;
for(let i = 0; i < len; ++i) func(arr[i])
}
const l = [1,2,3,4,5];
function logTimes2(x) {
console.log(x*2);
}
@sakex
sakex / sim.py
Last active May 2, 2020 13:47
Agents simulation COVID
import numpy as np
from numpy.random import uniform, randint
from typing import Tuple, List, Set
class Agent:
def __init__(self, x: float, y: float, contamined: bool):
self.__x: float = x
self.__y: float = y
self.__contamined: bool = False
self.__days_contamined: int = 0