Skip to content

Instantly share code, notes, and snippets.

View hewittc's full-sized avatar

Christopher Hewitt hewittc

View GitHub Profile
@hewittc
hewittc / bounce.c
Last active June 20, 2019 00:49
gdbus systemd unit restart
//
// Restart a systemd unit through gdbus
//
// Compile:
// gcc $(pkg-config --libs --cflags gio-2.0 glib-2.0) -o bounce bounce.c
//
// Equivalent to:
// # gdbus call --system --dest org.freedesktop.systemd1 --object-path /org/freedesktop/systemd1/unit/whatever_2eservice --method org.freedesktop.systemd1.Unit.ReloadOrRestart replace
//
@hewittc
hewittc / espressobin-notes
Created September 28, 2017 23:59
EspressoBin image building
Mirror of https://www.mail-archive.com/[email protected]/msg256534.html:
#############################
# 1. Get sources from the GIT
#############################
mkdir /work/community && cd /work/community
git clone [email protected]:MarvellEmbeddedProcessors/atf-marvell.git -b
atf-v1.3-armada-17.06
@hewittc
hewittc / python-dlopen
Last active November 22, 2024 22:22
Python ctypes automatically uses RTLD_NOW despite supplied flags. Here's something for fun.
#!/usr/bin/env python3
'''
test.c - clang -o test.so -fPIC -shared test.c
----------------------------------------------
extern int baz();
int foo() {
return 42;
}
@hewittc
hewittc / netbsd-passwd-migrate.py
Created January 14, 2015 20:08
Quick hack for migrating passwords from netbsd5 to centos7
#!/usr/bin/python2
#
# Quick hack for migrating passwords from netbsd5 to rhel7.
# Christopher Hewitt 2014
#
with open('master.passwd', 'r') as f:
print('#!/bin/sh')
for line in f:
locked = False