Skip to content

Instantly share code, notes, and snippets.

View 17twenty's full-sized avatar

Nick Glynn 17twenty

View GitHub Profile
package main
import (
"html/template"
"log"
"net/http"
"strconv"
)
/***********************
@17twenty
17twenty / readme.md
Created September 6, 2015 21:00
Using systemd-networkd

For those of you who want to try out systemd-networkd, you can read on, and find out in this tutorial how to switch from NetworkManager to systemd-networkd on Linux.

Requirement systemd-networkd is available in systemd version 210 and higher. Check the version of your systemd before proceeding.

$ systemctl --version

Switch from Network Manager to Systemd-Networkd

It is relatively straightforward to switch from Network Manager to systemd-networkd (and vice versa).

@17twenty
17twenty / awesome.patch
Created June 14, 2012 13:58
Really simple example of using get_user_pages and memory aligned allocation using posix_memalign. Hope this helps!
diff -PurN dummy/gu_page.c get_user_pages/gu_page.c
--- dummy/gu_page.c 1970-01-01 01:00:00.000000000 +0100
+++ get_user_pages/gu_page.c 2012-06-14 14:41:31.797310260 +0100
@@ -0,0 +1,124 @@
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+
@17twenty
17twenty / drop_encrypt.go
Created March 13, 2017 22:28 — forked from josephspurrier/drop_encrypt.go
Golang - Drag and Drop AES Encryption and Decryption
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
"io/ioutil"
"os"
@17twenty
17twenty / guide.txt
Created December 28, 2013 01:17
Checkpatch guide for newbies
Introduction
This document is aimed at new kernel contributors using "checkpatch.pl --file".
The first thing to remember is that the aim is not to get rid of every
checkpatch.pl warning; the aim is to make the code cleaner and more readable.
The other thing to remember is that checkpatch.pl is not a very smart tool and
there are mistakes that it misses so keep your eyes open for those as well.
For example, checkpatch.pl could warn about a badly formatted warning message.
@17twenty
17twenty / syscallReplace.c
Created May 2, 2012 13:23
Naughty codes
/* syscallReplace.c
* Replaces the 'open()' syscall and replaces it with something
* that looks for a given UID and reports it if it matches to klog
* This makes liberal use of some awesome code from the LKML and a syscall
* table finding technique from memset.
*/
/* Standard in kernel modules */
#include <linux/init.h>
#include <linux/kernel.h>
@17twenty
17twenty / gist:6925066
Last active March 25, 2023 13:41
Setting up your sdcard and u-boot's uEnv.txt for Beaglebone Black
# Find your micro SD card using lsblk - you're going to want to set your DISK parameter to it.
export DISK=/dev/mmcblk0
sudo dd if=/dev/zero of=${DISK} bs=1M count=16
sudo sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__
1,48,0xE,*
,,,-
__EOF__
@17twenty
17twenty / gist:4985374
Created February 19, 2013 12:20
Git diff odt files
To get Git to diff between your odt/odp/ods files you will need to do the following things:
Install a conversion tool
$ sudo yum install odt2txt
Create your git config info directory if it's not already there
$ mkdir -p ~/.config/git/info
Add in attributes (you can paste this straight in or edit the file accordingly)
$ cat > ~/.config/git/info/attributes <<DELIM
@17twenty
17twenty / howto.md
Created April 23, 2016 09:26
Can't connect to Belong Internet (the Australian ISP)

Problems with Belong Internet

Throttled - No DNS - Problem connecting - dns_probe_finished_bad_config

I recently took out a 12 month contract with the Australian ISP Belong and after first having speed problems where they'd stuck me on ADSL rather than the promised ADSL2 and having to moan at them on the phone a second problem started on the weekend before my 2nd month was about to start. None of my devices could connect to the network, Chrome was showing dns_probe_finished_bad_config and failing to load anything and refused to play

@17twenty
17twenty / Makefile
Created August 22, 2013 22:24
Simple Misc Driver Example
# Simple Makefile to build a simple misc driver
# Nick Glynn <Nick.Glynn@feabhas.com>
#
obj-m += misc_example.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
CC := $(CROSS_COMPILE)gcc