Skip to content

Instantly share code, notes, and snippets.

@piousdeer
piousdeer / youtube-reveal-tags.js
Last active August 7, 2020 08:12
A script/bookmarklet to reveal a YouTube video's tags (obsolete)
// Basically, this is a minimal version of this extension:
// https://chrome.google.com/webstore/detail/tags-for-youtube/dggphokdgjikekfiakjcpidcclbmkfga
void async function () {
if (!location.href.includes('/watch?v=') || window.tagsAreRevealed) return
window.tagsAreRevealed = true
const superTitle = document.querySelector('.super-title')
addEventListener('yt-page-data-updated', function cleanup () {
@piousdeer
piousdeer / youtube-max-res-thumbnails.js
Last active August 7, 2020 08:13
A script/bookmarklet to show a little "maxres" link next to every thumbnail on YouTube (obsolete)
document.querySelectorAll('#thumbnail').forEach(tn => {
if (tn.querySelector('.max-res-link')) {
return
}
const link = document.createElement('a')
try {
const maxResURL = tn.querySelector('img').src.replace(/\/[a-z]*default.jpg.*/, '/maxresdefault.jpg')
link.href = maxResURL
@piousdeer
piousdeer / wsl2-network.ps1
Created July 13, 2020 19:35 — forked from xmeng1/wsl2-network.ps1
WSL2 Port forwarding port to linux
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
__npm_safeguard() {
python3 ~/npm_safeguard.py $1 && command "$@"
}
npm() {
__npm_safeguard npm "$@"
}
pnpm() {
__npm_safeguard pnpm "$@"
}
yarn() {
@piousdeer
piousdeer / fake-fullscreen.js
Last active August 24, 2020 17:49
Force fullscreen UI on sites like YouTube without actually making your browser window fullscreen
let fullscreenElement;
Object.defineProperty(document, "fullscreenElement", {
get() {
return fullscreenElement;
},
set(value) {
fullscreenElement = value;
},
});
@piousdeer
piousdeer / .bashrc
Created June 8, 2021 17:05
Recognize music playing on your Linux computer via a terminal command
audd() {
api_token=test # get one from https://audd.io or use "test" if you don't mind the rate limits
source="$(pactl info | grep 'Default Sink' | cut -d":" -f2 | cut -c2-).monitor"
echo "Listening..."
ffmpeg -hide_banner -loglevel error -f pulse -i $source -t 7 -y /tmp/audd.ogg || return 1
echo "Uploading..."
curl -s -F api_token=$api_token -F file=@/tmp/audd.ogg https://api.audd.io | jq
}
@piousdeer
piousdeer / nvfixbl.sh
Created August 21, 2021 18:00 — forked from redsfyre/nvfixbl.sh
Simple script I wrote for Arch Linux to use Nvidia brightness setting properly
#!/bin/bash
for x in \
nvidia-460.67-5-x86_64.pkg.tar.zst \
nvidia-dkms-460.67-1-x86_64.pkg.tar.zst \
nvidia-settings-460.67-1-x86_64.pkg.tar.zst \
nvidia-utils-460.67-1-x86_64.pkg.tar.zst \
; do
test -f $x || \
#!/bin/bash
OUT_FILE="$(xdg-user-dir DOCUMENTS)/Домашка на $(date --iso-8601).pdf"
CAMERA_PATH="/run/user/1000/gvfs/sftp:host=192.168.0.2,port=1739/primary/DCIM/Camera"
convert -monitor -auto-orient -quality 35 -strip `ls -1tr $CAMERA_PATH/* | tail -${1:-1}` "$OUT_FILE"
<script>
function calc(from = 0, to = Infinity) {
const ctx = document.querySelector("canvas").getContext("2d");
ctx.font = "DejaVu Sans";
results = [];
let i = from;
while (i < to) {
let char;
if (i % 0xff == 0) {
console.log("0x" + i.toString(16));
{ lib
, fetchFromGitHub
, rustPlatform
, pkg-config
, dbus
, xorg
, pango
, cairo
, libusb
, libvpx