Skip to content

Instantly share code, notes, and snippets.

@gregorycollins
gregorycollins / ringbuf_counter.hpp
Created August 17, 2019 14:12
Arduino frequency counter ring buffer
// we expect a timeslice to be 1024 micros
static constexpr uint32_t TIMESLICE_LEN_US = 1024;
struct ringbuf_counter {
// must be power of 2
static constexpr int NDATA = 512;
uint16_t data[NDATA];
int start = 0;
int idx = 0;
int n = 0;
@gregorycollins
gregorycollins / 00-hacking-tilix-smaller-chrome.md
Last active November 16, 2023 12:55
How to hack your tilix to make tab/window chrome smaller

How to hack your Tilix to make tab/window chrome smaller

I really like the Tilix terminal emulator, but I hate how much space the default chrome takes up:

before

Those tabs are enormous! But did you know that this is user-configurable? GTK3 widgets are styled using CSS, and you can override the rules in ~/.config/gtk-3.0/gtk.css. Add the following rules to this file:

@gregorycollins
gregorycollins / keybase.md
Created August 20, 2016 03:10
Keybase proof

Keybase proof

I hereby claim:

  • I am gregorycollins on github.
  • I am gregorycollins (https://keybase.io/gregorycollins) on keybase.
  • I have a public key whose fingerprint is 7BAF 1DF4 E804 63DA D3BD B95B 8E2E D6AF EE46 7F65

To claim this, I am signing this object:

Bus 002 Device 002: ID 045e:090b Microsoft Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 9 Hub
bDeviceSubClass 0
bDeviceProtocol 3
bMaxPacketSize0 9
idVendor 0x045e Microsoft Corp.
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.4.0-0.rc4.git3.990.surfacepro3.fc24.x86_64 (mockbuild@copr-builder-268128603.novalocal) (gcc version 5.3.1 20151207 (Red Hat 5.3.1-1) (GCC) ) #1 SMP Thu Dec 10 19:24:04 UTC 2015
[ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.4.0-0.rc4.git3.990.surfacepro3.fc24.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/00 rd.luks.uuid=luks-697f4fed-dd84-4ae6-98ef-3781e522cd41 rhgb quiet LANG=en_US.UTF-8 nouveau.modeset=0 rd.driver.blacklist=nouveau video=vesa:off
[ 0.000000] x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
[ 0.000000] x86/fpu: xstate_offset[3]: 960, xstate_sizes[3]: 64
[ 0.000000] x86/fpu: xstate_offset[4]: 1024, xstate_sizes[4]: 64
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x01: 'x87 floating point registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x02: 'SSE re
(defun haskell-style ()
"Sets the current buffer to use Haskell Style. Meant to be
added to `haskell-mode-hook'"
(interactive)
(haskell-indent-mode 1)
(haskell-doc-mode 1)
;; (turn-on-haskell-indentation)
(setq haskell-indent-thenelse 2
haskell-indent-after-keywords '(("where" 2 0)
("of" 2)
@gregorycollins
gregorycollins / .gitignore
Last active August 29, 2015 14:01
Directory traversal with io-streams
#*#
*~
.cabal-sandbox
TAGS
cabal.sandbox.config
dist/

TODO list for Snap 1.0

  • add remaining repositories to buildbot
  • cleanup/refactor command-line config stuff
  • kill warnings
  • release io-streams-haproxy
    • one more cleanup TODO re: passing in SockAddrs
  • cleanup docs
    • io-streams-style tutorial material and usage examples for most of the api
  • clean up the tutorial material on the website (second priority to the api docstrings)
@gregorycollins
gregorycollins / .gitignore
Last active August 29, 2015 13:56
Haskell-cafe thread on Feb 19 2014
dist
*~
\#*
@gregorycollins
gregorycollins / Main.hs
Created June 10, 2013 12:44
Minimal failing test suite for hashable 1.2.0.7
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (forM_)
import Data.Bits
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as S
import Data.Hashable (hash)
import Data.List (foldl', intercalate)
import qualified Data.Map as Map