Skip to content

Instantly share code, notes, and snippets.

View dirkjanfaber's full-sized avatar

Dirk-Jan Faber dirkjanfaber

View GitHub Profile
@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 / 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 / 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 / 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 / servopwm.sh
Created March 15, 2018 12:49
Drive a servo via pwm on the Raspberry Pi from bash
#!/bin/bash
# https://learn.adafruit.com/adafruits-raspberry-pi-lesson-8-using-a-servo-motor/software
gpio -g mode 18 pwm
gpio pwm-ms
gpio pwmc 192
gpio pwmr 2000
while [ 1 -gt 0 ]
do
@dirkjanfaber
dirkjanfaber / as5047d.c
Created October 15, 2017 20:00
Read as54047d sensor from c on raspberry pi
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
#include <stdint.h>
#include <stdio.h>
@dirkjanfaber
dirkjanfaber / bitbangspi.c
Created October 11, 2017 07:32
Bitbang MLX90316 on SPI1
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <stdint.h>
#include <math.h>
#include "pigpio.h"
/*
@dirkjanfaber
dirkjanfaber / sine.c
Created September 12, 2017 19:40
In order to generate sine tabs for stepper motors
/*
Compile: gcc -o sine sine.c -lm -Wall
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#define PI 3.14159265
@dirkjanfaber
dirkjanfaber / commandline_param.c
Created June 1, 2017 09:31
split a commandline into command and paramters
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <ctype.h>
#include <string.h>
typedef struct
{
char *command;
char *parameter1;
@dirkjanfaber
dirkjanfaber / spotify_catcher.ino
Created October 24, 2016 19:16
Catch spotify song and display it on an esp98266 OLED
/*
Spotify catcher
Functions as a "man in the middle" for the Spotify Client scrobbles that
go to post.audioscrobbler.com (last.fm).
Works on an esp8266 (Arduino IDE). Connect an oled to pin 3 (SDA) and
pin4 (SCL) to show the currently playing song.
Make sure you put the IP of the esp9266 into /etc/hosts with the name