Skip to content

Instantly share code, notes, and snippets.

@wvdschel
wvdschel / command.sh
Created December 31, 2023 09:14
pytorch laptop benchmarks
for model in llama resnet50 resnet152 vgg16 hf_gpt2 hf_gpt2_large hf_bert yolov3; do python run.py -d cuda -t eval $model; python run.py -d cuda -t train $model; done 2>&1 | tee benchmark.log
@wvdschel
wvdschel / install.md
Created February 1, 2023 16:40
fedora install asus zephyrus 2022

Installing Linux on the Zephyrus G14

Change hostname

Defaults to fedora, can be changed through the settings app, under sharing or about

Installing asusctl

sudo sed -ise "s/^$/exclude=kernel kernel-core kernel-devel\n/g" /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/fedora-updates-testing.repo sudo dnf copr enable lukenukem/asus-kernel

@wvdschel
wvdschel / enable_hibernation.sh
Created October 20, 2022 08:02
Hibernation enablement script for Fedora
#!/bin/bash
# Based on https://fedoramagazine.org/hibernation-in-fedora-36-workstation/
set -eo pipefail
ZRAM_KBYTES=$(cat /proc/swaps | grep zram0 | sed -E 's/\s+/\t/g' | cut -f 3)
TOTAL_RAM=$(free -k | egrep ^Mem: | sed -E "s/ +/\t/g" | cut -f2)
TOTAL_ZRAM=0
UNCOMPRESSED_RAM=${TOTAL_RAM}
for ZRAM in ${ZRAM_KBYTES}; do
#!/bin/bash
# Spotify song recorder. Records songs played back with Spotify to ~/Music, as MP3 files with correct-ish ID3 tags.
# Songs are organized by album, one directory per album.
# Only works on Linux with pulseaudio (or pipewire).
#
# For Ubuntu users: apt install sox libsox-fmt-mp3 id3
# TODO: record into playlist directory instead of album
LAST_FILENAME=""
@wvdschel
wvdschel / Dockerfile
Last active October 3, 2018 11:20
Rustup/wasm32 dockerfile
FROM opensuse:tumbleweed
RUN zypper -n -q install bash tar curl clang llvm python git
ENV SHELL /bin/bash
RUN curl -sSf https://sh.rustup.rs | bash -s -- -y
RUN echo "export PATH=~/.cargo/bin:$PATH" >> ~/.bashrc
RUN source ~/.bashrc
import urllib.request
from html.parser import HTMLParser
class DilbertParser(HTMLParser):
def handle_starttag(self, tag, attrs):
if tag == "img":
comic = False
src = None
for attr in attrs:
name, value = attr
@wvdschel
wvdschel / limited.dylan
Created April 21, 2016 07:34
Some limited dylan snippet code.
module: limited
define class <some-thing> (<object>)
slot foo :: <integer>, init-keyword: foo:;
end class;
define method limited-instance? (obj :: <some-thing>, limited-type :: subclass(limited(<some-thing>)))
=> (result :: <boolean>)
format-out("limited-instance?(%=, %=)\n", obj, limited-type);
force-output(*standard-output*);
@wvdschel
wvdschel / Promoted_tweet_blocker.user.js
Created August 25, 2015 15:25
Hide promoted tweets greasemonkeyscript
// ==UserScript==
// @name Promoted tweet blocker
// @namespace org.fixnum.tweetblock
// @include https://twitter.com/
// @version 1
// @grant none
// ==/UserScript==
var tweets = document.getElementsByClassName("tweet");
for(tweetIdx = 0; tweetIdx < tweets.length; tweetIdx++) {
@wvdschel
wvdschel / minimum-int.dylan
Created February 13, 2015 08:08
Minimum integer bug
module: main
define function main() => ()
format-out("In main()\n");
let val :: <integer> = floor/($minimum-integer + 1, 10);
format-out("(min+1)/10: ");
format-out(integer-to-string(val));
format-out("\n");
set tabpagemax=12
set showtabline=2
map <F1> <ESC>:tabn 1<CR>
map <F2> <ESC>:tabn 2<CR>
map <F3> <ESC>:tabn 3<CR>
map <F4> <ESC>:tabn 4<CR>
map <F5> <ESC>:tabn 5<CR>
map <F6> <ESC>:tabn 6<CR>
map <F7> <ESC>:tabn 7<CR>