Skip to content

Instantly share code, notes, and snippets.

View DanielG's full-sized avatar

Daniel Gröber (dxld) DanielG

View GitHub Profile
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="pattern">
<!-- Get rid of that default 12pt font shit FcDefaultSubstitute does -->
<!-- holy fuck this is so obscure -->
<!--
So get this: when we get an empty property, i.e. it being missing from
the pattern in this case, qual=all will unconditionally succeed without
actually checking the condition. There doesn't seem to be a way to
import Data.Bits (xor)
import Data.Char (ord)
import Data.Word (Word8, Word32)
fnv1a :: [Word8] -> Word32
fnv1a = foldl (\h x -> (h `xor` fromIntegral x) * 0x01000193) 0x811C9DC5
-- Test vectors from https://tools.ietf.org/html/draft-eastlake-fnv-05#page-15
test = and
[ fnv1a [] == 0x811c9dc5
@DanielG
DanielG / split-kicad-lib.sh
Created October 23, 2016 21:01
Split KiCad schematic library into multiple files
################################################################################
# #
# Split KiCad EESchema library file into one file per part #
# #
# Copyright (C) 2016 Daniel Gröber <dxld@darkboxed.org> #
# #
# Copying and distribution of this file, with or without modification, #
# are permitted in any medium without royalty provided the copyright #
# notice and this notice are preserved. This file is offered as-is, #
# without any warranty. #
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: $0 debian-*.iso [PRESEED_FILE]">&2
exit 1
fi
tmpdir=$(mktemp -p "${TMPDIR:-/tmp/}" -d di-XXXX) || exit 1
trap 'rm -r '"$tmpdir" 0 2 15
-- $ ghc -package ghc -package ghc-paths GhcTestcase.hs
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import GHC
import GHC.Paths (libdir)
import DynFlags
import CoreMonad
import Pretty
import PprTyThing
@DanielG
DanielG / isitopen.sh
Created January 12, 2016 23:53
collectd exec plugin
#!/bin/sh
HOSTNAME="${COLLECTD_HOSTNAME:-localhost}"
INTERVAL="${COLLECTD_INTERVAL:-60}"
while sleep $INTERVAL; do
v=$(curl -s http://it-syndikat.org/status.txt | awk -vFS=, '{ print $1 }')
if [ x"$v" = x"true" ]; then
VALUE=1
else
-- $ ghc -package ghc -package ghc-paths GhcTestcase.hs
module Main where
import GHC
import GHC.Paths (libdir)
import DynFlags
import CoreMonad
import Pretty
import PprTyThing
import Outputable
@DanielG
DanielG / A.hs
Last active September 10, 2015 03:39
module A where
foo = 123
################################################################################
# #
# Find version differences in common packages of `ghc-pkg list` dumps. #
# #
# Copyright (C) 2015 Daniel Gröber <dxld@darkboxed.org> #
# #
# Copying and distribution of this file, with or without modification, #
# are permitted in any medium without royalty provided the copyright #
# notice and this notice are preserved. This file is offered as-is, #
# without any warranty. #
#!/bin/sh
set -x
NAME=thingy
MIRROR=ftp.at.debian.org/debian
tmpdir=$(mktemp -p "${TMPDIR:-/tmp/}" -d $NAME-XXXX) || exit 1
#tmpdir=/tmp/thingy
#mkdir -p "$tmpdir"