Skip to content

Instantly share code, notes, and snippets.

View dradtke's full-sized avatar

Damien Radtke dradtke

View GitHub Profile
@dradtke
dradtke / dbus-daemon.c
Last active November 6, 2023 12:41
An example Linux daemon using DBus.
/*
* This is an example Linux daemon that communicates via dbus.
* When run, it will daemonize and print to standard output two lines:
*
* 1. The PID of the daemon process, which can be used to kill it later with `kill -s SIGINT <pid>'
* 2. The unique D-Bus address it will be listening to
*/
#include <signal.h>
#include <stdio.h>
@dradtke
dradtke / import-github-issues.sh
Created June 22, 2018 21:27
A script for importing GitHub issues into a Fossil repository
#!/bin/bash
# +o histexpand is to avoid issues with ! showing up in ticket descriptions.
# The rest are just good Bash script practice.
set -eu -o pipefail +o histexpand
if [[ $# -lt 2 ]]; then
echo "usage: $0 <user> <repo>"
exit 1
fi
@dradtke
dradtke / Makefile
Created April 25, 2012 22:35
Hello World example for Allegro.
CC := gcc
CFLAGS := -g -Wall
LIBS := -lallegro
SOURCES := $(shell find src/ -type f -name "*.c")
OBJECTS := $(SOURCES:.c=.o)
TARGET := game
all: $(SOURCES) $(TARGET)
$(TARGET): $(OBJECTS)
@dradtke
dradtke / install-hashicorp.sh
Created June 25, 2019 14:43
Hashicorp tool installation script
#!/bin/bash
#
# This script installs Hashicorp tools from their releases page.
#
# It follows the Checksum Verification recommendation described
# at https://www.hashicorp.com/security, and downloads the app
# as /usr/local/bin/<app>-<version>.
if [[ $# -ne 2 ]]; then
echo "usage: $0 <app> <version>"
@dradtke
dradtke / tf.log
Created June 28, 2021 16:21
Linode Terraform Debug Logs
2021-06-28T11:19:26.579-0500 [DEBUG] Adding temp file log sink: /tmp/terraform-log020064480
2021-06-28T11:19:26.579-0500 [INFO] Terraform version: 1.0.1
2021-06-28T11:19:26.579-0500 [INFO] Go runtime version: go1.16.4
2021-06-28T11:19:26.579-0500 [INFO] CLI args: []string{"/home/damien/bin/terraform-1.0.1", "apply"}
2021-06-28T11:19:26.579-0500 [DEBUG] Attempting to open CLI config file: /home/damien/.terraformrc
2021-06-28T11:19:26.580-0500 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2021-06-28T11:19:26.580-0500 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2021-06-28T11:19:26.580-0500 [DEBUG] ignoring non-existing provider search directory /home/damien/.terraform.d/plugins
2021-06-28T11:19:26.580-0500 [DEBUG] ignoring non-existing provider search directory /home/damien/.local/share/terraform/plugins
2021-06-28T11:19:26.580-0500 [DEBUG] ignoring non-existing provider search directory /home/damien/.local/share/flatpak/exports/share/terraform/plugins
@dradtke
dradtke / opensuse_custom_image.txt
Created April 21, 2020 18:51
Discrepancies in "ip addr"
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 1a:ee:43:6d:a6:a5 brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether f2:3c:92:3e:bd:f6 brd ff:ff:ff:ff:ff:ff
@dradtke
dradtke / gist:5817376
Last active February 18, 2020 10:58
Simple Haskell RSS downloader and parser.
module Main where
import Control.Monad
import Data.List (find)
import Data.Maybe
import Network.HTTP
import System.Exit
import System.IO
import Text.XML.Light
job "hubot" {
region = "us"
datacenters = ["us-central"]
type = "service"
group "hubots" {
count = 1
task "hubot" {
@dradtke
dradtke / damienradtkecom.nomad
Created June 28, 2019 22:09
Certificate renewer addition to damienradtkecom.nomad
group "certrenewer" {
count = 1
task "certrenewer" {
driver = "raw_exec"
config {
command = "cert-renewer"
}
service {
@dradtke
dradtke / damienradtkecom.nomad
Created June 28, 2019 22:04
Nomad job for damienradtke.com
job "damienradtkecom" {
region = "us"
datacenters = ["us-central"]
type = "service"
group "server" {
count = 1
task "server" {