Skip to content

Instantly share code, notes, and snippets.

View dirkjanfaber's full-sized avatar

Dirk-Jan Faber dirkjanfaber

View GitHub Profile
@dirkjanfaber
dirkjanfaber / wikijs_issue_389.md
Last active September 26, 2018 07:23
wikijs issue 389

Test

Wikijs 1.0 will slow down when uploading this page. Check issue 389 for more info.

column A column B column C column D
a b c
a b c
a b c
a b
@dirkjanfaber
dirkjanfaber / keybase.md
Created September 13, 2019 09:04
keybase

Keybase proof

I hereby claim:

  • I am steviethecat on github.
  • I am darthfaber (https://keybase.io/darthfaber) on keybase.
  • I have a public key ASCzHML9I7mXmrd59QrbFDuRI6-Q1M-yRdO0ZH85mD1bAgo

To claim this, I am signing this object:

@dirkjanfaber
dirkjanfaber / thestoryofus.sh
Last active February 22, 2023 07:47
Download the story of us as epub (waitbutwhy)
#/bin/bash
dir=$(mktemp --directory)
declare -a input=()
cat <<__EOT__ > ${dir}/metadata.txt
---
title: The Story of Us
author: Tim Urban
rights: Creative Commons Non-Commercial Share Alike 3.0
@dirkjanfaber
dirkjanfaber / serial_plot_octave.m
Last active April 22, 2021 13:57
Plot incoming serial port data in Octave
pkg load instrument-control
% got this function from https://www.edn.com/read-serial-data-directly-into-octave/
function [char_array] = ReadToTermination (srl_handle, term_char)
% parameter term_char is optional, if not specified
% then CR = 'r' = 13dec is the default.
if (nargin == 1)
term_char = 13;
end
@dirkjanfaber
dirkjanfaber / tcw181b-cm.py
Created April 15, 2021 07:36
Simple python script to control a tcw181b-cm
#!/usr/bin/python
import requests
import argparse
device="tcw181b-cm"
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--device', nargs=1, help='device (default: '+device+')')
parser.add_argument('-f', '--off', type=int, action='append', nargs=1, help='turn relay X off')
@dirkjanfaber
dirkjanfaber / download_from_poeditor.py
Created April 28, 2021 14:50
Download and convert the po file for a given language from the poeditor.com file.
#!/usr/bin/env python3
from poeditor import POEditorAPI
import os
import subprocess
import time
import argparse
project_id = "435155"
filename = "victronconnect"
@dirkjanfaber
dirkjanfaber / venus_os_gui_test_language.sh
Last active May 31, 2021 08:31
POEditor download and convert file for Venus OS gui
#!/bin/bash
# language is first parameter, defaulting to 'nl' if none given
lang=${1:-nl}
# Add Qt to the path
PATH=$PATH:~/Qt/5.13.2/gcc_64/bin/
# export .po file. First query gives us a file location
po_file_location=$(curl -X POST https://api.poeditor.com/v2/projects/export \
@dirkjanfaber
dirkjanfaber / authenticator_code.py
Created June 14, 2021 07:46
Fetch the authenticator code so it is usable in a script.
#!/usr/bin/env python3
import authenticator as a
import os
def get_code():
cd = (a.data
.ClientFile(
os.environ['AUTHENTICATOR_PASSWORD'])
@dirkjanfaber
dirkjanfaber / bms-check.py
Created July 16, 2021 14:38
bms-check.py
#!/usr/bin/env python3
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose', action='store_true',
help='increase output verbosity' )
parser.add_argument('-d', '--dry-run', action='store_true',
help='work without input' )
@dirkjanfaber
dirkjanfaber / poeditor_add_reference_to_po.py
Created August 31, 2021 12:20
POEditor add reference to exported .po file
#!/usr/bin/env python3
import argparse
import polib
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--source', nargs=1,
help='source PO file')
parser.add_argument('-r', '--reference', nargs=1,