Skip to content

Instantly share code, notes, and snippets.

@yoosefi
yoosefi / plex-watched.py
Created June 25, 2022 23:07
plex: mark everything as watched
#!/usr/bin/python
## requires plexapi
## $ pip install plexapi
from plexapi.server import PlexServer
# admin token can be seen in the url when "Get Info > View XML" is opened.
plex = PlexServer('http://localhost:32400', 'ADMIN TOKEN HERE')
@yoosefi
yoosefi / toSeconds.sh
Last active April 10, 2022 21:04
bash function to convert [[hh:]mm:]ss[.ms] timecode to seconds
#!/bin/bash -eu
# toSeconds "1:00.25"
# "60.25"
# toSeconds "1:00:00.25"
# "3600.25"
toSeconds() {
echo $1 | awk -F: 'NF==3 { print ($1 * 3600) + ($2 * 60) + $3 } NF==2 { print ($1 * 60) + $2 } NF==1 { print 0 + $1 }'
}
@yoosefi
yoosefi / ffmpeg-nvenc.sh
Last active April 10, 2022 21:04
builds and installs ffmpeg with nvenc (debian)
#!/bin/bash
# builds and installs ffmpeg with nvenc (debian)
# install nv codec headers
if [ ! -d nv-codec-headers ]; then
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
fi
cd nv-codec-headers
git pull
sudo make install
@yoosefi
yoosefi / toMagic.php
Created June 1, 2020 08:08
generate php magic method annotations
#!/usr/bin/php
<?php
const ALIASES = [
'at' => 'iso8601',
'description' => 'text',
'on' => 'date',
'quantity' => 'qty',
];
@yoosefi
yoosefi / dark.css
Created March 12, 2020 03:41
dark theme for doxygen 1.8
/**
put this in your working directory and set the config option:
HTML_EXTRA_STYLESHEET=dark.css
*/
* {
background:black !important;
color:white !important;
font-family:monospace !important;
font-size:14pt !important;
text-shadow:none !important;
#!/bin/bash -eu
# Builds ffmpeg with nvenc for private use.
# Fetches main sources (ffmpeg, nvidia headers) for you.
# Uses autodetect to include extra media libraries already on your system;
# this doesn't download and compile the universe like other scripts.
# To use, place this script in its own directory and run it.
# The ffmpeg version can be changed below.
@yoosefi
yoosefi / ditto.md
Last active January 31, 2020 04:49
Ditto Glitch Lookup Table

Ditto Glitch Lookup Table

Below is a table that shows which special stats need to be mirrored by Ditto in order to later force a glitched battle with the corresponding pokemon.

Only exclusive/elusive pokemon are listed.

Special Pokemon Legitimate Source
14 Gengar Cable trade
15 Nidoran (F) Red/Blue. Route 22. Red handicap: 5% encounter rate
@yoosefi
yoosefi / psxrip.sh
Created December 7, 2018 01:26
raw psx cd dump, including bad sectors (their copy protection)
#!/bin/bash
# raw psx cd dump, including bad sectors (their copy protection)
# Usage: ./psxrip.sh GAME_NAME
umount /dev/sr0 2> /dev/null
set -e
cdrdao read-cd --read-raw --read-subchan rw_raw --datafile ${1}.bin --device /dev/sr0 --driver generic-mmc-raw ${1}.toc
toc2cue ${1}.toc ${1}.cue 2> /dev/null
rm ${1}.toc
eject /dev/sr0
@yoosefi
yoosefi / zapapp.sh
Last active December 27, 2017 00:24
best-effort package removal for android bloatware, via adb
#!/bin/bash
# best-effort package removal via adb.
# use on android bloatware.
#
# the first and only argument to this script is the package name.
for x in uninstall disable hide clear; do
echo $x
adb shell pm $x $1
done
@yoosefi
yoosefi / rename-to-md5.sh
Created September 1, 2016 00:25
Rename a file to its md5 checksum, keeping the extension
#!/bin/bash
# renames all input files to their md5 checksum, keeping the extension.
# this can be used as a nemo script.
for each in "$@"; do
NAME=$(basename "${each}")
EXT="${NAME#*.}"
DIR=$(dirname "${each}")
MD5=($(md5sum "${each}"))
mv "${each}" "${DIR}/${MD5}.${EXT}"
done