Skip to content

Instantly share code, notes, and snippets.

View premium-xcursor-theme.nix
{ stdenv, lib, fetchurl, variants ? [ "Premium" "Premium-left" ] }:
with lib;
stdenv.mkDerivation rec {
name = "${package-name}-${version}";
package-name = "premium-xcursor-theme";
version = "0.3";
src = fetchurl {
View kernel-modules.log
building '/nix/store/21084lh8071hfcb1rjizgn083ppbn2c5-kernel-modules.drv'...
created 19 symlinks in user environment
kernel version is 5.4.31
building '/nix/store/2wwqbwyszf80qhvalcjnwfns41zzjb8r-linux-5.4.31-modules.drv'...
created 19 symlinks in user environment
kernel version is 5.4.31
building '/nix/store/lvv6v9iih20spfjhj5y9m0mcw8r50q64-vimrc.drv'...
building '/nix/store/1fxgfrv7n4nfvvhx2abyf7igc93kgh9k-linux-5.4.31-modules-shrunk.drv'...
kernel version is 5.4.31
root module: xhci_pci
View ColumnBench.hs
import Criterion.Main
import Data.Foldable (foldl')
import Data.IntMap.Strict (IntMap, (!))
import Data.List (unfoldr)
import qualified Data.IntMap.Strict as IntMap
{-
resultFile=bench-$(date +%s).html
View conduintuition.hs
#! /usr/bin/env nix-shell
#! nix-shell -i runghc -p "haskellPackages.ghcWithPackages (ps: [ps.conduit])"
import Conduit
trans :: Monad m => ConduitT Int Int m ()
trans = do
takeC 3 .| mapC (+ 1)
takeC 3 .| mapC (* 2)
xs <- foldlC (\z x -> x : (take 2 z)) []
View postgres-in-minikube.sh
# create/update resources
kubectl --context=minikube apply -f ./postgres.yaml
# In order for the service to reach the statefulset, the following should
# be true:
# statefulset.spec.selector.matchLabels.app == service.spec.selector.app
# statefulset.spec.selector.matchLabels.role == service.spec.selector.role
# give the server some time to start up
# ...
View mysql-server-setup.sh
# install MySQL Server
nix-env --install --attr nixos.mysql57
sudo su
groupadd mysql
useradd -M \
--home-dir /var/lib/mysql \
--no-user-group \
--system \
--gid mysql \
View fold.hs
import Data.Maybe
import qualified Data.Map as Map
type Cell = Map.Map String Int
cell :: [(String, Int)] -> Cell
cell = Map.fromList
isOn :: Cell -> Bool
isOn = (> 0) . Map.findWithDefault 0 "on"
@ivanbrennan
ivanbrennan / show-256-colors.sh
Last active Apr 13, 2021
Use Bash to show all 256 colors supported by xterms
View show-256-colors.sh
#!/usr/bin/env bash
PADDING='Padding'
main() {
local xterm_start=0 \
xterm_width=8 \
xterm_height=2
local cube_start=$((xterm_start + xterm_width * xterm_height)) \
View foo_filter.c
#include <linux/module.h>
#include <linux/serio.h>
#include <linux/vmalloc.h>
#include <linux/i8042.h>
// Simplified i8042 key filter for example purposes
struct key_data {
bool is_pressed;
unsigned long updated_at;
@ivanbrennan
ivanbrennan / vim.vim
Last active Jul 9, 2017
Vim iskeyword workaround (after/ftplugin/vim.vim)
View vim.vim
setlocal iskeyword-=#
nnoremap <buffer> <silent> <C-]> :tag <C-R>=Vimcword()<CR><CR>
nnoremap <buffer> <silent> g<C-]> :tjump <C-R>=Vimcword()<CR><CR>
nnoremap <buffer> <silent> g] :tselect <C-R>=Vimcword()<CR><CR>
func! Vimcword()
let l:orig=&l:iskeyword
setlocal iskeyword+=#