Skip to content

Instantly share code, notes, and snippets.

View jdreaver's full-sized avatar

David Reaver jdreaver

View GitHub Profile
@Gunni
Gunni / nftables.conf
Created February 26, 2020 23:12
Example nftables.conf for a wireguard "server"
table inet filter {
chain inbound {
type filter hook input priority 0
policy drop
ct state invalid counter drop
ct state { established, related } counter accept
ip protocol icmp counter accept
ip6 nexthdr ipv6-icmp counter accept
@derekpowell
derekpowell / cbrm.R
Last active May 22, 2023 20:36
Wrapper for brm() that supports caching of BRMS models
cbrm <- function(formula,
data,
family = gaussian(),
prior = NULL,
autocor = NULL,
cov_ranef = NULL,
sample_prior = c("no", "yes", "only"),
sparse = FALSE,
knots = NULL,
stan_funs = NULL,
ghci> let manyThen x end = choice [(:) <$> x <*> manyThen x end, const [] <$> end]
ghci> parseOnly (manyThen anyChar (char ':')) (pack "he:llo:")
Right "he:llo"
@proger
proger / stack2.nix
Last active January 13, 2017 23:29
stack2nix
{ pkgs ? import (builtins.fetchTarball https://github.com/nixos/nixpkgs-channels/archive/nixos-unstable.tar.gz) {} }:
let
yaml = ./stack.yaml;
cabal2nix = "${pkgs.cabal2nix}/bin/cabal2nix --no-check --no-haddock";
in
pkgs.writeScript "build.sh" ''
export NIX_PATH=nixpkgs=${pkgs.path}
resolver=$(awk '/resolver:/{print $2}' ${yaml} | sed 's,\.,_,g')
@jdnavarro
jdnavarro / PKGBUILD
Last active February 13, 2017 17:08
Updated libtinfo AUR PKGBUILD for ncurses-6
# Maintainer: Alexej Magura <agm2819*gmail*>
#
#
pkgname=libtinfo
pkgver=5
pkgrel=7
pkgdesc="symlink to ncurses for use in cuda and other packages"
arch=('any')
url="http://www.gnu.org/software/ncurses/"
license=('unknown')
@sydcanem
sydcanem / Nginx gzip.conf
Last active March 3, 2024 18:27
Gzip configuration for Nginx
#Enable Gzip compressed.
gzip on;
# Enable compression both for HTTP/1.0 and HTTP/1.1.
gzip_http_version 1.1;
# Compression level (1-9).
# 5 is a perfect compromise between size and cpu usage, offering about
# 75% reduction for most ascii files (almost identical to level 9).
gzip_comp_level 5;
@zr40
zr40 / blocking.sql
Last active September 29, 2017 17:25
Show blocking locks
select
object,
case "lock requested"
when 'AccessExclusiveLock' then 'access exclusive'
when 'ExclusiveLock' then 'exclusive'
when 'ShareRowExclusiveLock' then 'share row exclusive'
when 'ShareLock' then 'share'
when 'ShareUpdateExclusiveLock' then 'share update exclusive'
when 'RowExclusiveLock' then 'row exclusive'
when 'RowShareLock' then 'row share'
@jaceklaskowski
jaceklaskowski / Rough Notes about CQRS and ES.md
Last active March 31, 2024 03:06
Rough Notes about CQRS and ES

Rough Notes about CQRS and ES

Once upon a time…

I once took notes (almost sentence by sentence with not much editing) about the architectural design concepts - Command and Query Responsibility Segregation (CQRS) and Event Sourcing (ES) - from a presentation of Greg Young and published it as a gist (with the times when a given sentence was heard).

I then found other summaries of the talk and the gist has since been growing up. See the revisions to know the changes and where they came from (aka the sources).

It seems inevitable to throw Domain Driven Design (DDD) in to the mix.

@Fristi
Fristi / Aggregate.hs
Last active November 6, 2022 20:50
DDD/Event Sourcing in Haskell. Implemented an aggregate as a type class and type families to couple event, command and error types specific to the aggregate. Errors are returned by using Either (Error e) (Event e). Applying Applicative Functors fits here well to sequentially check if the command suffice.
{-# LANGUAGE TypeFamilies #-}
import Data.Function (on)
import Control.Applicative
data EventData e = EventData {
eventId :: Int,
body :: Event e
}
@i-e-b
i-e-b / Readme_NIX_OS.md
Last active July 4, 2023 16:53
/etc/nixos/configuration.nix

My experiments with an XMonad setup in NixOS. This is my work box now, so it pretty much works.

probably needs:

# useradd -m iain
# passwd iain ...
# passwd root ...