Skip to content

Instantly share code, notes, and snippets.

@Schokokex
Schokokex / nix-sandbox.sh
Last active May 18, 2021
script for installing nix software in a soft sandbox
View nix-sandbox.sh
#!/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...
View nix-sandbox.sh
#!/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 / primes.sh
Created Dec 30, 2020
Print Primes in a linux shell
View primes.sh
i=0; while :; do i=$(expr $i + 1); if [ "$i: $i" == "$(factor $i)" ]; then echo $i; fi;done
@Schokokex
Schokokex / speedtest.js
Created Dec 15, 2020
acoustic speedtest
View speedtest.js
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 / install.cmd
Created Dec 15, 2020
wsl2.centos8.install
View install.cmd
;@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"