Skip to content

Instantly share code, notes, and snippets.

@rosterloh
rosterloh / .gitattributes
Last active May 30, 2025 10:36
My git aliases
*.java merge=mergiraf
*.rs merge=mergiraf
*.go merge=mergiraf
*.js merge=mergiraf
*.jsx merge=mergiraf
*.json merge=mergiraf
*.yml merge=mergiraf
*.yaml merge=mergiraf
*.html merge=mergiraf
*.htm merge=mergiraf
# import necessary packages
import sensor
import time
import image
# import the lcd optionally
# to use the LCD, uncomment Lines 9, 24, 33, and 100
# and comment Lines 19 and 20
#import lcd
@rosterloh
rosterloh / config.txt
Last active March 8, 2018 12:32
Raspberry Pi Config
kernel=u-boot-dtok.bin
framebuffer_depth=16
# Prevent the firmware from loading HAT overlays now that we handle pin muxing.
# ourselves. See:
# https://www.raspberrypi.org/documentation/configuration/device-tree.md#part3.4
dtoverlay=
dtparam=i2c_arm=on,i2c_arm_baudrate=400000
dtparam=spi=on
@Singleton
public class FirebaseAdapter {
private FirebaseAuth.AuthStateListener mAuthListener;
private FirebaseAuth mAuth;
@Inject
public FirebaseAdapter() {
mAuth = FirebaseAuth.getInstance();
initialiseAuth();
@rosterloh
rosterloh / .bash_aliases
Last active July 23, 2025 14:35
My bash aliases
#alias update='sudo apt update && sudo apt dist-upgrade -y --auto-remove'
alias update='sudo nala update && sudo nala upgrade -y'
alias adb_camera='adb shell am start -a android.media.action.IMAGE_CAPTURE'
alias adb_launch='adb shell am start -a android.intent.action.MAIN '
alias adb_brightness='adb shell am broadcast -a com.enhancedworld.devicemanager.SET_BRIGHTNESS --ei com.enhancedworld.devicemanager.extra.LEVEL '
alias adb_flash_boot='adb remount; adb sync; adb reboot bootloader; fastboot flash boot $OUT/boot.img; fastboot reboot'
alias adb_peripherals='adb shell dumpsys com.google.android.things.pio.IPeripheralManager'
alias cat='batcat --theme "Monokai Extended"'
alias ping='prettyping --nolegend'
alias du="ncdu --color dark -rr -x --exclude .git --exclude node_modules"
@rosterloh
rosterloh / DB410c.md
Created October 12, 2016 11:20
Notes from Coursera IoT Course 2
@rosterloh
rosterloh / daemon.c
Created April 25, 2016 07:23
A linux daemon skeleton
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int maxfd, fd;
@rosterloh
rosterloh / script.sh
Created April 6, 2016 07:48
A better options parser for a bash script
#!/usr/bin/env sh
# Default values for blank parameters
DEBUG=0
IN_FILE=/etc/some-input-file.conf
OUT_FILE=/var/log/some-output-file.log
# Option parser, the order doesn't matter
while [ $# -gt 0 ]; do
case "$1" in
@rosterloh
rosterloh / unblockdns.md
Created February 16, 2016 08:24 — forked from esamattis/unblockdns.md
Transparent Netflix only region unblock with Asuswrt Merlin

Transparent Netflix only region unblock with Asuswrt Merlin

Ad-free time!, UnoTelly etc. services provide a nice way to unblock regions for Netflix and others using their custom DNS servers.

But I don't want to direct all my DNS traffic to them and I'm too lazy to manually configure all my devices (phones, tablets, media center boxes etc.). So here's how to transparently unblock Netflix for all your devices using the [Asuswrt Merlin][merlin] firmware. It's a custom router firmware which can be used on the Asus RT-N66U router for example.

Prerequisites

Enable JFFS partition and SSH login from http://<ROUTER-IP>/Advanced_System_Content.asp

@rosterloh
rosterloh / seriallog.js
Created February 11, 2016 13:20
NodeJS serial logger script
'use strict'; // allows use of new ES6 syntax and features with node.js
let FTDI = 'ttyUSB0';
const PATH = './logger';
let serial = require('serialport');
let fs = require('fs');
fs.mkdir(PATH, () => {});