Skip to content

Instantly share code, notes, and snippets.

View decrn's full-sized avatar
🐓

Denis Carnier decrn

🐓
  • KU Leuven
  • Belgium
View GitHub Profile
[alias]
lg = !"git lg1"
lg1 = !"git lg1s --all"
lg2 = !"git lg2s --all"
lg3 = !"git lg3s --all"
lg4 = !"git lg4s --all"
lg1s = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
lg3s = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
lg2s = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
@decrn
decrn / calc.js
Last active February 16, 2019 17:17
export const calcStringSum = string => {
if (!string) // trivial case
return 0;
if (string.indexOf('//') === 0) { // custom delimeter
const delimeter = string.split('\n')[0].replace('//', '');
return reduceByDelimeter(delimeter, string.split('\n')[1]);
}
# !bin/sh
# groups words by most common occurence and highlights colon emojis e.g. :slighty_smiling_face:
# useful in combination with e.g. a message scraper for Slack
# macOS? brew install gnu-sed to swap casing
# change all seds to gsed or add it to your PATH
# ps coreutils is bloatware
echo 'some random random text :stuckouttongue:' \
| tr '[:upper:]' '[:lower:]' \
(library
(queue)
(export new queue? enqueue! serve! peek full? empty?)
(import (rnrs base)
(srfi :9)
(rnrs mutable-pairs))
(define default-size 5)
(define-record-type queue
(make s h r)
@decrn
decrn / pentago.hs
Last active December 5, 2020 20:06
data ValidatedCommand = RegularMove Char Char String Char
| WinningMove Char Char
| InvalidCommand
deriving (Show, Eq)
validateCommand :: Command -> ValidatedCommand
validateCommand (row:col:',':rot)
| length rot >= 2 &&
row `elem` "abcdef" &&
col `elem` "123456" &&