Skip to content

Instantly share code, notes, and snippets.

View martinbeentjes's full-sized avatar

Martin Beentjes martinbeentjes

View GitHub Profile
@martinbeentjes
martinbeentjes / merge_json_files.py
Last active January 26, 2023 09:58
Merge json files into one json file
#!/usr/bin/python
import json
import glob
result = []
for f in glob.glob("*.json"):
with open(f, "rb") as infile:
result.append(json.load(infile))
@martinbeentjes
martinbeentjes / pmap.kt
Created November 7, 2019 08:18
execute .map in parallel
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.coroutineScope
// Run in parallel
suspend fun <A, B> Iterable<A>.pmap(f: suspend (A) -> B): List<B> = coroutineScope {
map { async { f(it) } }.awaitAll()
}
@martinbeentjes
martinbeentjes / cuts.txt
Last active July 21, 2018 18:42
Splitting mp4 files into clips
01.mp4 00:00:00 00:02:44
01.mp4 00:02:44 00:06:12
01.mp4 00:06:12 00:06:52
01.mp4 00:06:52 00:09:41
01.mp4 00:09:41 00:13:55
01.mp4 00:13:55 00:14:34
01.mp4 00:14:34 00:20:31
01.mp4 00:20:31 00:41:55
01.mp4 00:41:55 01:00:53
---
@martinbeentjes
martinbeentjes / config.sh
Last active September 3, 2019 09:43
Enabling Wi-Fi eduroam on embedded hardware for InHolland locations
#!/bin/bash
iface=wlan0
# This script applies WPA configuration so that eduroam can be accessed via a Raspberry Pi.
if [ "$(id -u)" != "0" ]; then
echo " This script must be run as root" 1 >&2
exit 1
else
killall wpa_supplicant
#include "ros/ros.h"
#include "mavros/RCIn.h"
#include "mavros/OverrideRCIn.h"
int c=0;
int __ct=0;
void rc_in_callback(mavros::RCIn);
void doSequence(ros::Publisher,int);
@martinbeentjes
martinbeentjes / override_rc.py
Created October 13, 2015 09:17 — forked from vo/override_rc.py
Quick hack to override RC over MAVLink with arrow keys
#!/usr/bin/env python
import sys, os
from optparse import OptionParser
import Tkinter as tk
# tell python where to find mavlink so we can import it
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../mavlink'))
from pymavlink import mavutil
@martinbeentjes
martinbeentjes / JavaIRC
Last active August 29, 2015 14:07
Java IRC library
JavaIRC