Skip to content

Instantly share code, notes, and snippets.

@wvdschel
wvdschel / 14b.txt
Last active January 30, 2025 08:25
deepseek test
<think>
Okay, so the user wants some JavaScript that makes every link on a page prefetch content when hovered over and then replace the entire document body with that content when clicked. They also mentioned handling the back button correctly and
ensuring scripts in the new content run.
First, I need to figure out how to handle link hover events. Using the 'onmouseover' event seems right for this. When a user hovers over a link, I'll trigger the prefetching.
Next, I should create an invisible iframe to load the linked content without affecting the current page. This way, when the user clicks, I can quickly replace the body with the preloaded content. So, I'll set up an event listener for
'mouseover' on all anchor tags and load the href into the iframe then.
Now, for the click event, I need to prevent the default navigation using 'onmousedown'. This way, when the user clicks, it doesn't navigate normally but instead replaces the body with the iframe's content. But wait, if the user is
0 52
1 100
2 150
3 200
4 250
5 300
6 350
7 399
8 449
9 499
# Monitor AMDGPU clocks and power draw
sudo watch -n 0.2 cat /sys/kernel/debug/dri/0/amdgpu_pm_info
# Set upper power draw limit:
echo 85000000 | sudo tee /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon4/power1_cap
@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*);