Skip to content

Instantly share code, notes, and snippets.

@r4dian
r4dian / Dark mode for any website.js
Created November 25, 2022 15:47
Make any website have a dark mode, by saving each of these 3 lines as a bookmarklet.
// dimmer
javascript:var style=document.createElement('style');style.innerText='html{filter:saturate(25%) invert(80%) brightness(80%)}img{filter:invert(100%);}';var head=document.getElementsByTagName('head')[0];head.appendChild(style);
// less dim, but still inverted
javascript:var style=document.createElement('style');style.innerText='html{filter:saturate(33%) invert(90%);}img{filter:invert(100%);}';var head=document.getElementsByTagName('head')[0];head.appendChild(style);
// undo dimmer
javascript:var style=document.createElement('style');style.innerText='html{filter:saturate(100%) invert(0%) brightness(100%);}img{filter:invert(0%);}';var head=document.getElementsByTagName('head')[0];head.appendChild(style);
@r4dian
r4dian / Sample hunt.sh
Created April 11, 2022 19:47
Copy all the samples from your NI Expansions to `C:\Users\Public\Documents\NI Samples` so you can put them on a hardware sampler, etc.
cd /mnt/c/Users/Public/Documents &&\
rsync -a --prune-empty-dirs --include '*/' --include '*.wav' --exclude '*' . ./NI\ Samples
@r4dian
r4dian / test-tone.sh
Created March 15, 2022 18:00
Generate a test tone, where the comment in the .wav data is the command used to create it .... [bash / zsh]
sox -V -r 48000 -n -b 16 -c 2 --comment "$(tail -1 $HISTFILE | sed 's/.\{15\}//')" tone.wav synth 30 sin 220 vol -12dB; #test tone: a3 note / 220Hz, -12dB
@r4dian
r4dian / convert-reaper-mov-to-mp4.sh
Last active April 11, 2022 19:49
Reaper's default video output when you selct `QT/MOV/MP4` is .mov. But fuck .mov, I want an .mp4
ffmpeg -i filename.mov -codec:audio aac -b:audio 128k -codec:video libx264 -crf 23 filename.mp4
@r4dian
r4dian / sane_keymap.km
Created February 13, 2022 21:33
Sane keymap for hUGEtracker with white notes on z-m & q-p, and with ♯/♭ on S-J & 2-0
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<grid version="3">
<saveoptions create="True" position="True" content="True"/>
<design columncount="2" rowcount="30" fixedcols="0" fixedrows="1" defaultcolwidth="120" isdefaultcolwidth="1" defaultrowheight="22" isdefaultrowheight="0" color="clWindow">
<columns columnsenabled="True" columncount="2">
<column0>
<index value="0"/>
<buttonstyle value="0"/>
<title>
@r4dian
r4dian / use edge instead of cli.sh
Created January 14, 2022 20:02
Use edge to open websites from WSL.
sudo update-alternatives --set www-browser /usr/bin/wslview
@r4dian
r4dian / StickyNotes-OnTop.ps1
Created August 2, 2019 09:51
Make Sticky Notes Always on Top
$code = @'
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
'@
Add-Type $code -Name Utils -Namespace Win32
<#
while(1){
$hwnd = [Win32.Utils]::GetForegroundWindow()
Get-Process |
Where-Object { $_.mainWindowHandle -eq $hwnd } |
@r4dian
r4dian / rename-wav-with-pitch.py
Last active July 3, 2022 12:13 — forked from kroger/convert.py
Rename wav files using frequency and pitch detection
#!/usr/bin/env python2
import subprocess, os, glob, math
## /!\ Python 2.x /!\
## requires [Aubio](https://aubio.org)
## Rename wav files using frequency and pitch detection:
## GTR_08.wav ---> automated pitch detection & file renaming ---> GTR_08 - C3 (+0cents) - 130.81Hz.wav
@r4dian
r4dian / .zshrc
Last active March 13, 2018 16:39
Make zsh completion follow the same colouring as `ls`
# Linux / Windows WSL:
# echo $LS_COLORS and paste in double-quotes below
# BSDs or MACOS:
# echo $LSCOLORS and convert to gnu/linux format with https://github.com/ggreer/lscolors
export LS_COLORS="no=00:fi=00:di=34:ow=34;40:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.hpp=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.cl=32:*.sh=32:*.bash=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.go=32:*.sql=32:*.csv=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.PNG=3
@r4dian
r4dian / Unfollow.js
Created October 16, 2017 11:13
Unfollow everything & everyone on Facebook.
// Manual set-up
// click: ▼ at top-right
// Newsfeed preferences
// "Unfollow people to hide their posts" (also includes all Pages, which are not real "people")
// Scroll to the bottom of that so they are all listed
// Open console (f12, or whatever the fuck on MacOS) and paste these two lines:
var e = document.querySelectorAll("._5u3n");
e.forEach(function(elem){ elem.click() });