Skip to content

Instantly share code, notes, and snippets.

Pepijn de Vos pepijndevos

Block or report user

Report or block pepijndevos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 / 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 /
Created Apr 20, 2019
Finds the bit permutation that gives the lowest maximum
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();
View gbsynth.ino
#include <SPI.h>
#include "registers.h"
#define SEMI 1.059463
#define LED 20
#define BITS(val, ofst, wdt) (((val) & ((1<<wdt)-1)) << ofst)
void writeReg(byte addr, byte data) {
pepijndevos /
Created Dec 25, 2018
Parse Whatsapp chats
import re
import sys
import glob
import pandas as pd
import matplotlib.pyplot as plt
regex = """(?P<datetime>\d{1,2}\/\d{1,2}\/\d{1,4}, \d{1,2}:\d{1,2}( (?i)[ap]m)*) - (?P<name>.*(?::\s*\w+)*|[\w\s]+?)(?:\s+(?P<action>joined|left|was removed|changed the (?:subject to "\w+"|group's icon))|:\s(?P<message>(?:.+|\n(?!\d{1,2}\/\d{1,2}\/\d{1,4}, \d{1,2}:\d{1,2}( (?i)[ap]m)*))+))"""
files = sys.argv[1:]
pepijndevos / CMakeLists.txt
Last active Oct 3, 2018
Assorted build files
View CMakeLists.txt
cmake_minimum_required(VERSION 3.10.2)
# 3rd party tools
find_package(Qt5 COMPONENTS
Widgets Network Qml Quick
Gamepad QuickControls2 REQUIRED)
pepijndevos / core.clj
Created Aug 5, 2018
Concatenative Behavior Tree in Clojure
View core.clj
(ns b3clj.core)
; TODO more stack operations
(defn spush
([stack item] (spush stack :data item))
([stack typ item] (update-in stack [typ] conj item)))
(defn spop
([stack] (spop stack :data))
([stack typ]
pepijndevos /
Last active Jan 24, 2018
Generate an image for every subtitle line
ffmpeg -y -txt_format text -i sw.mkv;
mkdir frames;
mkdir memes;
timestamps=$(grep -oE " [0-9]{2}:[0-9]{2}:[0-9]{2}";
for ts in $timestamps
ffmpeg -y -ss $ts -copyts -i sw.mkv -vf subtitles=sw.mkv -frames:v 1 frames/out$i.jpg;
convert frames/out$i.jpg -background White -pointsize 32 label:'Can we really turn every line from the prequels into a meme?' +swap -gravity Center -append memes/meme$i.jpg;
pepijndevos /
Last active Jan 10, 2018
Download elevation data and convert to Cities: Skylines height map
import struct
import numpy as np
import scipy.ndimage
import scipy.ndimage.filters
import requests
import zipfile
import io
import sys
import os
import matplotlib.pyplot as plt
pepijndevos / modulation.m
Created Jun 27, 2017
Test script for a guitar tuner
View modulation.m
snd = audioread('plong.wav');
fs = 44100;
mono = snd(:,1);
%sound(mono, fs);
s = size(mono);
t = (1:s)/fs;
order = 5;
fcut = 20;
You can’t perform that action at this time.