Skip to content

Instantly share code, notes, and snippets.

View joncol's full-sized avatar

Jonas Collberg joncol

View GitHub Profile
@masaeedu
masaeedu / init-haskell.sh
Last active May 20, 2021 15:24
Basic nix haskell setup
#!/usr/bin/env bash
set -Eeuxo pipefail
# Set up git
git init
gitignore haskell
echo '*.cabal' >> .gitignore
# Set up niv
niv init
@mvolfik
mvolfik / AoCleaderboard.py
Created December 12, 2019 15:19
View timestamps when people solved specific task of Advent of Code
import json
from datetime import datetime as dt
import requests
import re
y = input("YEAR: ")
cookie = {'session': "YOUR SESSION COOKIE HERE (it's valid for 30 days)"}
homepage = requests.get('https://adventofcode.com/'+y+'/leaderboard/private', cookies=cookie)
for id in re.compile(r"(?<=\/"+y+r"\/leaderboard\/private\/view\/)(\d+)").findall(homepage.content.decode()):
print("\n"*5)
data = json.loads(requests.get('https://adventofcode.com/'+y+'/leaderboard/private/view/'+id+'.json', cookies=cookie).content)
@thalesmg
thalesmg / dhall-lsp.el
Created January 24, 2020 22:58
Using Dhall LSP Server on Emacs
(add-to-list 'lsp-language-id-configuration '(dhall-mode . "dhall"))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection "dhall-lsp-server")
:major-modes '(dhall-mode)
:server-id 'dhall-lsp-server))
@stoand
stoand / kakrc
Created April 29, 2020 06:06
Use ripgrep instead of grep with kakoune
# Install: https://github.com/BurntSushi/ripgrep#installation
# Use ripgrep instead of grep
set-option global grepcmd 'rg -Hn --no-heading'
@hadilq
hadilq / NixOS-guide.md
Last active September 1, 2025 04:59
Encypted LUKS LVM Btrfs Root with Opt-in State on NixOS

I'm trying to follow this guide to install NixOS using Btrfs, LUKS and LVM. The main usage of this page for me will be remembering what I did! My laptop is ASUS ROG GL553VD.

Just downloaded Plasma Desktop, 64bit and create a bootable Flash Drive. Then boot up to NixOS Live CD. Using gparted to create two partitions, One 200MB vfat EFI partittion and the rest of SSD drive will be an encrypted partition.

DISK=/dev/nvme0n1
@rksm
rksm / init.el
Created February 7, 2021 20:16
shackle
(defun rk/open-compilation-buffer (&optional buffer-or-name shackle-alist shackle-plist)
"Helper for selecting window for opening *compilation* buffers."
;; find existing compilation window left of the current window or left-most window
(let ((win (or (loop for win = (if win (window-left win) (get-buffer-window))
when (or (not (window-left win))
(string-prefix-p "*compilation" (buffer-name (window-buffer win))))
return win)
(get-buffer-window))))
;; if the window is dedicated to a non-compilation buffer, use the current one instead
(when (window-dedicated-p win)
@vivshaw
vivshaw / README.md
Last active November 4, 2025 10:37
🙈🙉🙊 Three Wise Monkeys 🙈🙉🙊
@fufexan
fufexan / cpp-dev-env-flake.nix
Last active October 24, 2025 09:37
C/C++ dev environment in Nix, using Clang
{
description = "C/C++ environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils, ... }@inputs:
utils.lib.eachDefaultSystem (
@bashbunni
bashbunni / .zshrc
Last active October 31, 2025 10:48
CLI Pomodoro for Linux (zsh)
# study stream aliases
# Requires https://github.com/caarlos0/timer to be installed. spd-say should ship with your distro
declare -A pomo_options
pomo_options["work"]="45"
pomo_options["break"]="10"
pomodoro () {
if [ -n "$1" -a -n "${pomo_options["$1"]}" ]; then
val=$1

Setting up qemu VM using nix flakes

Did you know that it is rather easy to setup a VM to test your NixOs configuration?

Create simple flake:

# flake.nix
{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";