Skip to content

Instantly share code, notes, and snippets.

@tcheneau
tcheneau / libnl-3-old-kernel-fix.patch
Created December 11, 2012 16:31
fix for libnl for building libnl3 with old kernel headers
From 25526cfd3af3513ae5fe527cb45688873e06f983 Mon Sep 17 00:00:00 2001
From: Tony Cheneau <tony.cheneau@amnesiak.org>
Date: Mon, 10 Dec 2012 17:22:33 -0500
Subject: [PATCH] Set three constants that are not defined in the old kernel header.
---
lib/netfilter/exp_obj.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/lib/netfilter/exp_obj.c b/lib/netfilter/exp_obj.c
@tcheneau
tcheneau / mountchroot.sh
Created April 4, 2013 17:55
Chroot into a Cloonix virtual machine disk image.
#!/bin/sh
losetup /dev/loop1 $1
losetup -o 1048576 /dev/loop2 /dev/loop1
mount /dev/loop2 /media/vm
mount -t proc foo /media/vm/proc
mount -t sysfs foo /media/vm/sys
mount -o bind /dev /media/vm/dev
mount -o bind /selinux /media/vm/selinux
chroot /media/vm
@tcheneau
tcheneau / license.c
Last active December 16, 2015 10:49
Header for code developed at NIST
/*
* Conditions Of Use
*
* This software was developed by employees of the National Institute of
* Standards and Technology (NIST), and others.
* This software has been contributed to the public domain.
* Pursuant to title 15 United States Code Section 105, works of NIST
* employees are not subject to copyright protection in the United States
* and are considered to be in the public domain.
* As a result, a formal license is not needed to use this software.
@tcheneau
tcheneau / tcp-client.c
Last active December 16, 2015 13:49
IPv6 enabled TCP client
/* from the getaddrinfo(3) manual */
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#define BUF_SIZE 500
@tcheneau
tcheneau / serial-driver.patch
Last active December 18, 2015 08:09
Add an empty line at the bottom to make git happy when trying to apply the patch
diff --git a/drivers/net/ieee802154/Kconfig b/drivers/net/ieee802154/Kconfig
index 08ae465..c982fa8 100644
--- a/drivers/net/ieee802154/Kconfig
+++ b/drivers/net/ieee802154/Kconfig
@@ -45,3 +45,7 @@ config IEEE802154_MRF24J40
This driver can also be built as a module. To do so, say M here.
the module will be called 'mrf24j40'.
+
+config IEEE802154_SERIAL
@tcheneau
tcheneau / set-serial.sh
Last active December 18, 2015 08:49
This script is an helper that sets up a IEEE 802.15.4 device on a Linux. It will properly initialize the 6LoWPAN stack and can even assign IPv6 addresses. This script is mostly useful when deploying a batch of devices.
#!/bin/sh
# Conditions Of Use
#
# This software was developed by employees of the National Institute of
# Standards and Technology (NIST), and others.
# This software has been contributed to the public domain.
# Pursuant to title 15 Untied States Code Section 105, works of NIST
# employees are not subject to copyright protection in the United States
# and are considered to be in the public domain.
@tcheneau
tcheneau / udp-client.c
Last active December 20, 2015 04:59
A ready to import code for seting up a UDP socket using the destination address and port.
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#define PRINTF(...) printf(__VA_ARGS__)
@tcheneau
tcheneau / set-econotag.py
Created December 18, 2013 17:21
Send the appropriate commands in order to set the parameters (e.g. short/long address) in a Redbee Econotag device. This script requires a modified version of the Econotag "linux-serial" firmware.
#!/bin/env python
# Tony Cheneau <tony.cheneau@nist.gov>
# Conditions Of Use
#
# This software was developed by employees of the National Institute of
# Standards and Technology (NIST), and others.
# This software has been contributed to the public domain.
# Pursuant to title 15 United States Code Section 105, works of NIST
# employees are not subject to copyright protection in the United States
@tcheneau
tcheneau / .config
Last active August 29, 2015 14:00
Docker-ready hardened kernel config for OVH Kimsufi 2G server (need GRSEC)
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.14.2 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
@tcheneau
tcheneau / Caddyfile
Created October 24, 2017 21:34
Caddy configuration for mastodon (for my own instance) (ripped off from https://gist.github.com/yukimochi/bb7c90cbe628f216f821e835df1aeac1)
https://social.amnesiak.org {
log /var/lib/caddy/data/social.amnesiak.org-access.log
errors /var/lib/caddy/data/social.amnesiak.org-access.err
root /data/mastodon/public
gzip
header / {
Strict-Transport-Security "max-age=31536000;"