Skip to content

Instantly share code, notes, and snippets.

@ailrk
ailrk / fix-amdgpu23-driver-crash.sh
Last active October 10, 2024 21:23
Fix crashes casued by amdgpu bugs
#/usr/bin/bash
# Set kernel parameter `amdgpu.vm_update_mode=3` to fix crash caused by bugs comes with amdgpu
#sane bash environment
set -euo pipefail
echo "setting kernel parameter amdgpu.vm_update_mode=3..."
if [ -z ${GRUB_DEFAULT+x} ]; then
GRUB_DEFAULT="/etc/default/grub"
@ailrk
ailrk / .zshrc
Created June 10, 2021 00:01
zsh (grml) nix shell proompt configuration
# Created by newuser for 5.6.2
function nix_shell_prompt () {
REPLY=${IN_NIX_SHELL+(nix) }
}
function py_virtual_env_prompt () {
REPLY=${VIRTUAL_ENV+(${VIRTUAL_ENV:t}) }
}
grml_theme_add_token nix-shell -f nix_shell_prompt '%F{megenta}' '%f'
grml_theme_add_token py-virtual-env -f py_virtual_env_prompt '%F{magenta}' '%f'
autoload -U colors && colors
@ailrk
ailrk / join.ts
Created April 3, 2021 22:23
join promise till one layer
const join = async <T>(p: Promise<Promise<T>>) => {
return await p;
};
const unify = async<T>(p: Promise<T>) => {
const v = await p;
if (v instanceof Promise) {
unify(join(v));
}
return v;
@ailrk
ailrk / .ghci
Last active February 17, 2021 21:05
colorized pprint for ghci
:def pretty \_ -> return ("import qualified Text.Show.Pretty as ShowPretty__\n:set -interactive-print ShowPretty__.pPrint")
:def cpretty \_ -> return ("import qualified Text.Show.Pretty as ShowPretty__\nimport qualified Language.Haskell.HsColour as HSC__\nimport qualified Language.Haskell.HsColour.Colourise as HSCR__\nlet _colorPrint_ = Prelude.putStrLn . HSC__.hscolour HSC__.TTY HSCR__.defaultColourPrefs False False \"\" False . ShowPretty__.ppShow\n:set -interactive-print _colorPrint_")
:def unpretty \_ -> return (":set -interactive-print Prelude.print")
{
"configurations": {
"CPPDefault": {
"adapter": "vscode-cpptools",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/<executable>",
"cwd": "${workspaceRoot}/",
"externalConsole": true,
"stopAtEntry": true,