Skip to content

Instantly share code, notes, and snippets.

@hololeap
hololeap / hls-gen.console
Last active October 14, 2022 15:12
A working LSP configuration in kate. The haskell "settings" section was generated by `haskell-language-server generate-default-config`.
> haskell-language-server generate-default-config 2>&1
2022-10-14T15:06:34.447979Z | Info | No log file specified; using stderr.
2022-10-14T15:06:34.448942Z | Info | haskell-language-server version: 1.8.0.0 (GHC: 9.0.2) (PATH: /usr/bin/haskell-language-server)
2022-10-14T15:06:34.449637Z | Info | Directory: /mnt/development/git/gentoo-haskell/x11-terms/termonad
2022-10-14T15:06:34.450156Z | Info | Logging heap statistics every 60.00s
{
"haskell": {
"checkParents": "CheckOnSave",
"checkProject": true,
@hololeap
hololeap / 01.hs
Created December 3, 2021 12:00
AoC 2021/02
module Main (main) where
import Data.ByteString.Char8 qualified as B
import Y2021.D02.Movement
main :: IO ()
main = do
ds <- B.getContents >>= parseAllIO . B.lines
let Pos (Depth d, Horizontal h) = travel ds
print $ d * h
@hololeap
hololeap / btrfs-balance.bash
Last active October 2, 2021 20:33
Script to conditionally run `btrfs balance`, suitable as a cron job
#!/bin/bash
allocated_threshold="95" # Don't run balance if less than this much is allocated (percentage)
fs="/"
# The limit (in chunks) is set to be:
# 75% of unused allocated data (in GiB), rounded up to nearest integer
# This may need to be adjusted depending on the setup
balance_awk_formula='{printf("-dlimit=%d\n",($1 - $2) * 0.75 + 1)}'
@hololeap
hololeap / makePackages.log
Created December 4, 2019 19:35
makePackages.log
+ set -euo pipefail
+ '[' 0 -ne 1 ']'
+ echo 'usage: utils/makePackages.sh [link|copy]'
usage: utils/makePackages.sh [link|copy]
+ echo ''
+ echo 'build a standalone GHC package from the GHC sources'
build a standalone GHC package from the GHC sources
+ '[' link = copy ']'
+ echo 'populating source tree with symbolic links to upstream files'
@hololeap
hololeap / makePackages.log
Created December 4, 2019 19:35
makePackages.log
+ set -euo pipefail
+ '[' 0 -ne 1 ']'
+ echo 'usage: utils/makePackages.sh [link|copy]'
usage: utils/makePackages.sh [link|copy]
+ echo ''
+ echo 'build a standalone GHC package from the GHC sources'
build a standalone GHC package from the GHC sources
+ '[' link = copy ']'
+ echo 'populating source tree with symbolic links to upstream files'
=== Running ebuild phase killold as root:root...
=== Starting builtin_killold
=== Done builtin_killold
=== Completed ebuild phase killold
=== Running ebuild phases init saveenv as paludisbuild:paludisbuild...
=== Starting builtin_init
=== Done builtin_init
=== Starting builtin_saveenv
=== Done builtin_saveenv
=== Completed ebuild phases init saveenv
=== Running ebuild phase killold as root:root...
=== Starting builtin_killold
=== Done builtin_killold
=== Completed ebuild phase killold
=== Running ebuild phases initmisc saveenv as paludisbuild:paludisbuild...
=== Starting builtin_initmisc
=== Done builtin_initmisc
=== Starting builtin_saveenv
=== Done builtin_saveenv
=== Completed ebuild phases initmisc saveenv
@hololeap
hololeap / system_log
Created July 19, 2015 20:22
Syslog a few minutes before lockup
------------[ cut here ]------------
Jul 19 13:05:38 [kernel] [ 583.814700] WARNING: CPU: 0 PID: 0 at drivers/gpu/drm/i915/intel_uncore.c:566 hsw_unclaimed_reg_debug.isra.14+0x78/0xa0()
Jul 19 13:05:38 [kernel] [ 583.814702] Unclaimed register detected before reading register 0x44200
Jul 19 13:05:38 [kernel] [ 583.814704] Modules linked in: hid_generic usbhid tun bnep binfmt_misc vfat fat btusb btbcm btintel bluetooth crc16 joydev mousedev dell_laptop rtsx_pci_ms dcdbas rtsx_pci_sdmmc dell_wmi memstick sparse_keymap hid_multitouch coretemp x86_pkg_temp_thermal intel_powerclamp crc32_pclmul crc32c_intel wl(POE) iTCO_wdt ghash_clmulni_intel hwmon iTCO_vendor_support aesni_intel aes_x86_64 glue_helper lrw gf128mul psmouse ablk_helper cfg80211 i2c_i801 cryptd serio_raw rtsx_pci rfkill fan wmi snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic snd_hda_intel i2c_hid hid snd_hda_controller snd_hda_codec ehci_pci xhci_pci xhci_hcd ehci_hcd sdhci_acpi snd_hwdep 8250_dw sdhci dw_dmac dw_dmac_core ac mmc_cor
#/bin/sh
fallocate -l 500M /var/db/portage-loop
mkfs.btrfs /var/db/portage-loop
mv /usr/portage/distfiles /var/db
rm -rf /usr/portage
mkdir /usr/portage
mount -o noatime,loop,compress-force /var/db/portage-loop /usr/portage
mkdir /usr/portage/distfiles
https://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/
https://ftp.rnl.tecnico.ulisboa.pt/pub/gentoo/gentoo-distfiles/
https://ftp.ucsb.edu/pub/mirrors/linux/gentoo/
https://gentoo.wheel.sk/
https://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/
https://lug.mtu.edu/gentoo/
https://www.mirrorservice.org/sites/distfiles.gentoo.org/