Skip to content

Instantly share code, notes, and snippets.

View 17twenty's full-sized avatar

Nick Glynn 17twenty

View GitHub Profile
@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
@17twenty
17twenty / statementFriendly.go
Created September 29, 2022 02:49
Clean and simplify a user entered name to make a Stripe 22 character friendly merchant name
package main
import (
"fmt"
"regexp"
"strings"
)
var re *regexp.Regexp
@17twenty
17twenty / timersDemo.c
Created February 6, 2015 10:56
Example of using timers and signal masks
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
/* This could be CLOCK_MONOTONIC or CLOCK_REALTIME depending on what you want */
#define CLOCKID CLOCK_REALTIME
static void
@17twenty
17twenty / WorkingRemote.md
Created July 24, 2019 21:02
Top tips for working remotely

Be as available as possible This is probably the best piece of advice I received from a friend prior to starting my new job. Things move quickly back at the home office, and since you’re not there, there’s a built-in delay for someone wishing to communicate with you.

If it always takes hours for someone to get your ear for just a minute, you’ll build a reputation as someone who’s “never around”–even if only subconsciously–among your coworkers.

As a remote employee, you have to work harder at being available to avoid the impression that you’re never available.

Strive to build a reputation as someone who is quick to respond. Be eager to hear the latest developments on projects so that you’re never out of sync with everyone else in your office.

@17twenty
17twenty / gist:2fb30a22141d84e52446
Created February 22, 2016 01:04
POST with NewRequest using Golang
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
)
@17twenty
17twenty / crazyOlSelectCase.go
Last active July 20, 2022 12:46
Using reflect.SelectCase - an example
package main
import (
"log"
"reflect"
"time"
)
func main() {
c1 := make(chan int)
@17twenty
17twenty / am33xx.dtsi
Last active July 17, 2022 02:23
Example Platform Driver to set mux on Beaglebone based on device tree
/*
* Device Tree Source for AM33XX SoC
*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*/
@17twenty
17twenty / migrate-readme.md
Last active June 15, 2022 03:16
How to use Migrate (incl sqlc.yaml too!)

Golang Migrations Made Easy

Prerequisite / Getting Started

$ go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
$ migrate -h
Usage: migrate OPTIONS COMMAND [arg...]
       migrate [ -version | -help ]
@17twenty
17twenty / ratelimitMyCopy.go
Created June 14, 2017 08:39
Demo of using golang.org x time rate RateLimiter
package main
import (
"bytes"
"fmt"
"io"
"time"
"golang.org/x/time/rate"
)
@17twenty
17twenty / reader.go
Created March 10, 2016 03:22 — forked from jedy/reader.go
processes communicate with shared memory in golang
package main
// #include <stdlib.h>
// #include "wrapper.c"
import "C"
import "unsafe"
import "fmt"
func read(filename string) string {
f := C.CString(filename)