Skip to content

Instantly share code, notes, and snippets.

@ivanbrennan
ivanbrennan / premium-xcursor-theme.nix
Created February 13, 2021 21:43 — forked from ottidmes/premium-xcursor-theme.nix
Custom X cursor in NixOS
{ 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 {
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
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
#! /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)) []
@ivanbrennan
ivanbrennan / postgres-in-minikube.sh
Last active October 31, 2024 17:36
PostgreSQL in minikube
# 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
# ...
# 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 \
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 October 25, 2024 18:03
Use Bash to show all 256 colors supported by xterms
#!/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)) \
#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 September 22, 2024 18:27
Vim iskeyword workaround (after/ftplugin/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+=#