Skip to content

Instantly share code, notes, and snippets.

@martinbeentjes
martinbeentjes / merge_json_files.py
Last active Jan 8, 2020
Merge json files into one json file
View merge_json_files.py
#!/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 Nov 7, 2019
execute .map in parallel
View pmap.kt
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 Jul 21, 2018
Splitting mp4 files into clips
View cuts.txt
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 Sep 3, 2019
Enabling Wi-Fi eduroam on embedded hardware for InHolland locations
View config.sh
#!/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
View testoverride.cpp
#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 Oct 13, 2015 — forked from vo/override_rc.py
Quick hack to override RC over MAVLink with arrow keys
View override_rc.py
#!/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 Aug 29, 2015
Java IRC library