Skip to content

Instantly share code, notes, and snippets.

View jfischoff's full-sized avatar
™️
Jonathaning

Jonathan Fischoff jfischoff

™️
Jonathaning
View GitHub Profile
@canton7
canton7 / 0main.md
Last active November 7, 2023 08:16
Local versions of tracked config files

How to have local versions of tracked config files in git

This is a fairly common question, and there isn't a One True Answer.

These are the most common techniques:

If you can modify your application

@jb55
jb55 / RPS.hs
Created July 6, 2012 18:45
teaching a friend Haskell with a nice game of rock paper scissors
import Control.Monad
import Control.Monad.Random
data RPS = Rock | Paper | Scissors
deriving (Show, Eq, Read)
data Result = Win | Lose | Tie
deriving (Show, Eq)
@sjoerdvisscher
sjoerdvisscher / Poly.hs
Created July 11, 2012 22:15
Converting Conor McBride's Polynomial datatype to raising/falling factorial base.
{-# LANGUAGE FlexibleInstances, DeriveFunctor #-}
import Control.Applicative
import Data.Unfolder
import Data.Unfoldable
import Data.Ratio
import Test.QuickCheck hiding (choose)
class Polynomial p where
@sjoerdvisscher
sjoerdvisscher / 1d
Created August 11, 2012 11:16
A total map as a zipper of an infinite perfect binary tree
-1 0 1 2 3 4 5
\ / \\/ \ / \ /
\ // \ /
\ // \ /
\\ /
\\ /
\\ /
\\/
//
//
@HeinrichApfelmus
HeinrichApfelmus / GameLoop.hs
Created October 2, 2012 16:49
Game loop in reactive-banana
{------------------------------------------------------------------------------
reactive-banana
Implementation of an "industry strength" game loop with fixed time step
and variable fps.
See also http://gafferongames.com/game-physics/fix-your-timestep/
-------------------------------------------------------------------------------}
{-# LANGUAGE NoMonomorphismRestriction #-}
module Main where
@NicolasT
NicolasT / paxos.rst.lhs
Created December 7, 2012 22:29
Basic Paxos in Haskell
> module Paxos.Basic where
> import Data.List (maximumBy)
> import Data.Maybe (catMaybes)
Phase 1a: Prepare
=================
A Proposer (the leader) creates a proposal identified with a number N. This
number must be greater than any previous proposal number used by this Proposer.
Then, it sends a Prepare message containing this proposal to a Quorum o
@mtigas
mtigas / README.md
Last active December 16, 2022 02:12
this is the nginx config for https://mike.tig.as/, with config to avoid the BEAST exploit (by using TLS 1.2+ ciphers or RC4) and enable SSL perfect forward secrecy (by preferring ECDHE ciphers)

[mike.tig.as][mta] server configuration

This gist contains the nginx and tor configurations for the [mike.tig.as][mta] servers, mainly to show:

  • Use of the chris-lea/nginx-devel PPA to allow use of SPDY.
  • ssl_ciphers selection to mitigate BEAST attack, enable [perfect forward secrecy][pfs] if possible and select the strongest possible ciphers within those bounds. (Exception is made for several ciphers at the end of list, for compatibility reasons.)
@dmalikov
dmalikov / README.markdown
Last active May 31, 2019 06:31
Nix / NixOS links

Various blog posts related to Nix and NixOS


General

@ghostbar
ghostbar / loggly.service
Created March 26, 2015 22:57
loggly.service
[Unit]
Description=Loggly Forwarder
[Service]
ExecStart=/bin/sh -c "journalctl -o short -f | awk '{ print \"\<34\>1\", $0; fflush(); }' | awk '{ print $0, \"[your-consumer-token-from-loggly@41058 tag='deis']\" }' | ncat --ssl logs-01.loggly.com 6514"
[Install]
WantedBy=multi-user.target
[X-Fleet]
@aravindet
aravindet / jsoncat.md
Last active February 16, 2024 13:08
PostgreSQL JSON Concatenation Operator

Postgres lacks convenient operators for modifying JSON or JSONB values. A common operation one might want to do is to change one property in a JSON column across multiple rows, like:

UPDATE example SET json_col = json_col || '{ "prop": true }'::jsonb WHERE <conditions>;

The || operator is the natural choice for this because it is also used for array and jstore concatenation in Postgres.

This short PLV8 function adds the JSON concatenation operator. It is significantly more powerful than the array and hstore counterparts, and are capable of: