Skip to content

Instantly share code, notes, and snippets.

Avatar

Pepijn de Vos pepijndevos

View GitHub Profile
View domijn.py
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox()
driver.get("https://www.domijn.nl/mijndomijn/inloggen/")
assert "Domijn" in driver.title
@pepijndevos
pepijndevos / main.rs
Last active May 3, 2020
ILI9341 program for STM32F4DISCOVERY that draws a circle, slowly.
View main.rs
#![no_main]
#![no_std]
use panic_halt as _;
use stm32f407g_disc as board;
use crate::board::{
hal::stm32,
hal::spi::{Mode, Phase, Polarity, Spi},
@pepijndevos
pepijndevos / sgp30_influx.py
Created Apr 9, 2020
Send info from a DHT11 and SGP30 to an Influxdb
View sgp30_influx.py
import time
import board
import busio
import adafruit_sgp30
import adafruit_dht
from influxdb import InfluxDBClient
from math import exp
from queue import Queue
from threading import Thread, Event
@pepijndevos
pepijndevos / plot.py
Last active Mar 23, 2020
Plot reported cases since reaching 100 cases
View plot.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
cutoff = 100
def flip(name):
df = pd.read_csv(name)
del df['Lat']
@pepijndevos
pepijndevos / logicgame.clj
Created Oct 16, 2019
A game of logic gates
View logicgame.clj
(ns logicgame.core
(:use clojure.core.logic)
(:gen-class))
(defne ando [a b y]
([1 1 1])
([1 0 0])
([0 1 0])
([0 0 0]))
@pepijndevos
pepijndevos / jitter_PKGBUILD
Created Oct 3, 2019
Arch build scripts for GNU Poke
View jitter_PKGBUILD
_pkgname=jitter
pkgname=$_pkgname-git
pkgver=r596.745ba29
pkgrel=1
pkgdesc="Jitter"
arch=('i686' 'x86_64')
url="http://ageinghacker.net/git/cgit.cgi/jitter"
license=('GPL')
depends=()
makedepends=('git')
View format.py
import fileinput
width = 640//16
height = 480//16
lineno = 0
for line in fileinput.input():
if line.startswith("# vim:"): continue
if line.startswith("-"):
fill = height-(lineno%height)
View sim.py
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.interpolate import interp1d
import ipdb
#ref The Finite-Difference Time Domain Method for Solving Maxwell’s Equations
size = 15
@pepijndevos
pepijndevos / tsp.adb
Last active Apr 21, 2019
Continuous Traveling Salesman Problem
View tsp.adb
with Ada.Text_IO;
use Ada.Text_IO;
with Ada.Containers.Vectors;
with Ada.Numerics.Discrete_Random;
with Ada.Numerics.Float_Random;
with Ada.Numerics.Generic_Elementary_Functions;
with Ada.Numerics.Elementary_Functions;
procedure TSP is
@pepijndevos
pepijndevos / popcount.rs
Created Apr 20, 2019
Finds the bit permutation that gives the lowest maximum
View popcount.rs
use rand;
fn transpose(data: &[u64], col: usize) -> u64 {
return data.iter().fold(0, |acc, x| (acc<<1) | ((x >> col) & 1));
}
fn masked_lowest_popcount(mask: u64, data: Vec<u64>) -> (Vec<u64>, Vec<u64>) {
let mut lowest = u32::max_value();
let mut values: Vec<u64> = Vec::new();
let mut remainder: Vec<u64> = Vec::new();
You can’t perform that action at this time.