Skip to content

Instantly share code, notes, and snippets.


Harvey Chapman sr105

View GitHub Profile
sr105 /
Created Jul 18, 2021
Embedded Server Installation - DHCP, TFTP, NFS
Network Booting

It saves time during development to boot the kernel and use a networked rootfs from the developer’s machine. It also allows for editing on the host files used live on the target

Two variants: with/without PXE

The device can be statically configured in the boot loader to know it’s IP address and what files to download and how to boot them. OR you can configure a DHCP server to tell the device those steps. The latter is preferred as it moves more of the configuration to the developer’s machine and requires less interaction with U-Boot on the device over the console.

sr105 /
Created Feb 5, 2019
Same named network for multiple docker compose files

Same Network for Multiple docker-compose files

The A file creates the network. The B file connects to it.


docker-compose -f docker-compose-A.yaml up -d
docker-compose -f docker-compose-B.yaml up -d

Testing what names Docker puts into DNS:

sr105 / atoi_strrev.c
Last active Oct 11, 2018
C atoi and strrev (for fun)
View atoi_strrev.c
/* Test:
* gcc -o atoi atoi.c
* ./atoi 12345 123465
* Output:
* Number: 12345 Reverse: 54321 54321 54321
* Number: 123456 Reverse: 654321 654321 654321
#include <stdio.h>
#include <stdlib.h>
sr105 /
Last active Sep 28, 2018
TOTP Authenticator Python Implementation
#!/usr/bin/env python3
import time
import urllib.parse
import base64
import hmac
import types
sr105 / woodLength.js
Last active Aug 30, 2018
woodLength Javascript Kata
View woodLength.js
// Written for node v8.1.3
// nvm install v8.1.3
// nvm use v8.1.3
// node woodLength.js
function woodLength(dimensions) {
sr105 / gdb_commands
Created Sep 27, 2017
gdb sysroot not working
View gdb_commands
# set sysroot /opt/poky/2.3.1/sysroots/corei7-64-poky-linux
directory /opt/poky/2.3.1/sysroots/corei7-64-poky-linux
set breakpoint pending on
file /work/build-mxencoder-Poky-Debug/mxencoder-test/mxencoder-test
target remote | ssh -T root@ gdbserver - /opt/mxencoder-test/bin/mxencoder-test
b mxencoder-test.cpp:67
View gstencodingprofile.c
static GstEncodingProfile* create_encoding_profile()
// At some point, we might want to allow multiple formats etc.
// FIXME: hook up Configure() parameters here
GstEncodingContainerProfile *container;
GstEncodingVideoProfile *video;
GstCaps *caps, *restr;
caps = gst_caps_new_simple("video/quicktime", "variant", G_TYPE_STRING, "iso", NULL);
container = gst_encoding_container_profile_new(NULL, NULL, caps, NULL);
View gist:66c8dc0a55f8970ff1efd342f3a6ce98
gst-launch-1.0 -e v4l2src ! video/x-raw,width=3840,height=2160,format=YV12 \
! vaapih264enc bitrate=20000 rate-control=2 ! queue \
! mpegtsmux ! filesink location=file.mp4
gst-launch-1.0 -e v4l2src ! video/x-raw,width=1280,height=720 ! queue ! xvimagesink
sr105 /
Last active May 25, 2017
Luhn algorithm
def luhn(cc, debug=False):
double = True
sum = 0
doubled = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]
if debug:
print('{:15}{:15}{:15}{}'.format('digit', 'sum digit', 'sum', 'double'))
for n in (int(c) for c in reversed(cc.replace(' ', ''))):
value = doubled[n] if double else n
if debug:
print('{:<15}{:<15}{:<15}{}'.format(n, value, sum, double))
sr105 /
Last active Jun 16, 2017
Instructions and script for telling a local emacs to open a remote file via ssh while at the remote prompt using iTerm2 triggers
# Don't forget to read the SECURITY WARNING below, and then don't
# say you didn't know.
## Description
# tl;dr -- Type `e filename` on a remote host via ssh and your local
# emacs will open the remote file. Don't have the `e` function