Skip to content

Instantly share code, notes, and snippets.

@wvengen
wvengen / gen_wpa_sup.py
Created November 25, 2016 09:56
wifi export for network-manager
#!/usr/bin/env python
#
# Export network-manager WiFi connection details to a wpa-supplicant
# file. This can be saved to an Android device, so you have all your
# laptop's WiFi connections on your phone right away (root required).
#
# python gen_wpa_sup.py >foo
# adb push foo /sdcard/foo
# adb shell
# su -c 'cat /sdcard/foo >>/data/misc/wifi/wpa_supplicant.conf'
@wvengen
wvengen / update-freevpn.sh
Last active April 28, 2019 17:24
Update on-demand PPTP configuration for free VPNs
#!/bin/sh
#
# Update freevpn.se pptp configuration
#
# Since the password changes now and then, it's useful to update it automatically.
# Make sure you've installed lynx. Tested on Debian.
#
URL=https://www.freevpn.se/accounts/
PEERNAME=freevpn.se
@wvengen
wvengen / NOTES.md
Last active March 13, 2021 17:20
Freedrum on Linux

Freedrum on Linux

The recently released Freedrum has no official Linux support. But, fortunately, it uses standard Bluetooth LE MIDI. It doesn't seem to work out of the box, yet (on Ubuntu 17.04, most probably Ubuntu 18.04 will support it directly).

Bluez 5.46

One really needs bluez 5.46 or higher. On Ubuntu, these are packaged in artful proposed (amd64). Unfortunately, MIDI support is not enabled in this build (Ubuntu bug #1713017).

So you'll need to download the sources, install dependencies plus libasound2-dev, build and install resulting debs. You may need to add --enable-midi to debian/rules. Like this:

@wvengen
wvengen / parse_xml_streaming.rb
Last active July 11, 2023 18:48
Parsing an XML stream from an HTTP endpoint in Ruby.
#!/usr/bin/env ruby
#
# Example of parsing a remote XML stream.
#
# Fetches data from an HTTP endpoint, and processes it bit by bit, without
# loading the whole file into memory.
#
# This example shows recent articles from the W3C blog feed.
#
require 'nokogiri'
@wvengen
wvengen / get-publitas.sh
Created October 11, 2018 09:10
Generate PDF from Publitas folder URL
#!/bin/sh
#
# Generates PDF from Publitas images (online folder service)
# Stores generated PDF and JSON (which may contains links).
#
# Requirements:
# - wget https://www.gnu.org/software/wget/
# - jq https://stedolan.github.io/jq/
# - imagemagick https://www.imagemagick.org/
#
@wvengen
wvengen / NOTES.md
Last active July 14, 2021 07:03
Semantic web of food notes
@wvengen
wvengen / README.md
Last active December 13, 2019 12:13
Run OpenLabeler with system Java

OpenLabeler is a pretty nice image annotation package, but I had issues getting it to run. Plus I'd rather use the system-supplied Java environment, instead of a bundled one, and install it for a user (not in the system).

This happens on a Debian or Ubuntu system (with apt and deb tools available).

  1. Download deb package of latest release.
  2. Extract its contents: dpkg-deb -x ~/.local/openlabeler openlabeler-1.2.0.deb
  3. Make sure you have OpenJDK 11 installed plus apt install libopenjdk-11-jre libopenjfx-java
  4. Cleanup directory structure: cd ~/.local/openlabeler && mv opt/OpenLabeler/* . && rmdir opt/OpenLabeler opt
@wvengen
wvengen / README.md
Last active November 9, 2020 13:18
Seasonality in foods, international data

Buying fruit and vegetables in-season makes a difference in sustainability. What information is there on this, also internationally? Eventually it would be nice to provide this in a common format, so that you can give your country, and find what food products are in-season.

Below are some seasonal calendars. Most are a calendar with what fruits, vegetables (and sometimes other foods) are in-season, per month or per season. This is often tied to local availability. If greenhouses are used to grow, the local option may not be the most sustainable one, only Milieu Centraal appears to talk about this.

@wvengen
wvengen / gather-fish-data-fishbase.rb
Last active March 3, 2020 12:27
Enriching ASFIS with Wikidata or FishBase
#!/usr/bin/env ruby
#
# We start with the list at:
# http://www.fao.org/fishery/collection/asfis
# Then we query FishBase (and SeaLifeBase) for the ID and NL name.
#
# Before running this script, make sure you have the ASFIS spreadsheet,
# and make sure you've created the CACHEDIR directory (which stores all
# requests, so you can run this again without having to wait for the requests).
#
@wvengen
wvengen / launchpad_x.ctlr
Created June 17, 2020 13:06
Luppp controller definition for the Novation Launchpad X
{
"name": "Novation Launchpad X",
"author": "wvengen",
"link": "https://novationmusic.com/en/launch/launchpad-x",
"inputBindings": [
{
"status": 176,
"data": 89,
"action": "grid:launch_scene",
"scene": 0