Skip to content

Instantly share code, notes, and snippets.

View fortytw2's full-sized avatar
🕶️

Ian fortytw2

🕶️
View GitHub Profile
import qualified Codec.Binary.UTF8.String as UTF8
import qualified Data.Map as M
import Graphics.X11.ExtraTypes.XF86
( xF86XK_AudioLowerVolume,
xF86XK_AudioMute,
xF86XK_AudioRaiseVolume,
xF86XK_MonBrightnessDown,
xF86XK_MonBrightnessUp,
)
import System.Exit (ExitCode (ExitSuccess), exitWith)
func CreatePDFFromHTML(inputHTML []byte) ([]byte, error) {
dirName, err := ioutil.TempDir("", "pdf-generator")
if err != nil {
return nil, err
}
// remove this and log the dirName if you need to debug the HTML
defer os.RemoveAll(dirName)
// log.Println(dirName)
@fortytw2
fortytw2 / determinism.go
Last active April 12, 2023 12:05
shutdown
package main
type Server struct {
shutdown chan struct{}
close chan struct{}
}
func NewServer() *Server {
s := &Server{
shutdown: make(chan struct{}, 0),
#!/bin/bash
## Last modified 2016-12-09 - Just Add Power
## Sets the 3G Receiver to operate as a fully functional 3G device
## Once applied the 3G unit will reboot and ONLY be compatible with other 3G units in 3G mode
astparam s soc_op_mode 3
astparam s remote_edid_patch 00000001
astparam save
echo '/usr/local/bin #'
sleep 5
reboot

Keybase proof

I hereby claim:

  • I am fortytw2 on github.
  • I am fortytw2 (https://keybase.io/fortytw2) on keybase.
  • I have a public key whose fingerprint is 30CE 29C8 C62F E18E D789 8D41 9FE0 138C 1DDD 46B8

To claim this, I am signing this object:

@fortytw2
fortytw2 / agnoster.zsh-theme
Created October 12, 2016 08:48
kube + go + agnoster zsh
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
@fortytw2
fortytw2 / leaktest.go
Created April 26, 2016 15:05
Goroutine Leak Test Helper
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package leaktest provides tools to detect leaked goroutines in tests.
// To use it, call "defer util.LeakTest(t)()" at the beginning of each
// test that may use goroutines.
// copied out of the cockroachdb source tree
package util
@fortytw2
fortytw2 / main.go
Created November 16, 2015 13:10
Encapsulated, gracefull goroutine shutdown in
package main
import (
"log"
"os"
"os/signal"
"sync"
"syscall"
"time"
)