Skip to content

Instantly share code, notes, and snippets.

@Schokokex
Schokokex / install.cmd
Created December 15, 2020 20:24
wsl2.centos8.install
;@Findstr -bv ;@F "%~f0" | powershell -command - & powershell -NoLogo & goto:eof
$osName='CentOS8'
$appdir = "$env:LOCALAPPDATA\$osName"
$downloadCent8 = $true # contains launcher and rootfs.tar.gz
$downloadLauncher = $false # in case downloadCent8 = $false
$rootFsFile = "rootfs.tar.gz"
$cent8Url = "https://github.com/yuk7/CentWSL/releases/download/8.1.1911.1/CentOS8.zip"
$launcherUrl = "https://github.com/yuk7/wsldl/releases/download/20100500/Launcher.exe"
@Schokokex
Schokokex / speedtest.js
Created December 15, 2020 20:27
acoustic speedtest
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
function playNote(frequency, duration, callback) {
duration = duration / 1000;
// create Oscillator node
var oscillator = audioCtx.createOscillator();
oscillator.type = 'square';
oscillator.frequency.value = frequency; // value in hertz
@Schokokex
Schokokex / primes.sh
Created December 30, 2020 13:52
Print Primes in a linux shell
i=0; while :; do i=$(expr $i + 1); if [ "$i: $i" == "$(factor $i)" ]; then echo $i; fi;done
@Schokokex
Schokokex / nix-sandbox.sh
Created May 18, 2021 08:33
nix "sandbox"
#!/bin/sh
export package=steam
export homefolder=$package
export cmd=$package
export HOME=/home/jj/.home/$homefolder
mkdir -p ~/.config/nixpkgs/
printf "{ allowUnfree = true; }" > ~/.config/nixpkgs/config.nix
@Schokokex
Schokokex / nix-sandbox.sh
Last active May 18, 2021 16:44
script for installing nix software in a soft sandbox
#!/bin/sh
which /bin/sh &>/dev/null || echo /bin/sh not found!! Try putting /bin/bash at begin of script!
which /bin/sh &>/dev/null || exit
read -e -p "Nix package name: " -i "firefox" nixPackageName || exit
read -e -p "Sandbox home folder: " -i "$HOME/.home/$nixPackageName" sandboxHome || exit
read -e -p "App calling command: " -i "$nixPackageName" appCmd || exit
echo downloading package...
nix-shell -p $nixPackageName --command exit
echo preparing sandbox home...
@Schokokex
Schokokex / librewolf.sh
Last active January 31, 2022 13:10
librewolf
sudo apt update
sudo which wget || sudo apt install wget
echo "deb [arch=amd64] http://deb.librewolf.net $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/librewolf.list
sudo wget https://deb.librewolf.net/keyring.gpg -O /etc/apt/trusted.gpg.d/librewolf.gpg
sudo apt install librewolf -y