Skip to content

Instantly share code, notes, and snippets.

View tytydraco's full-sized avatar
🦆
Quack!

Tyler Nijmeh tytydraco

🦆
Quack!
View GitHub Profile
@tytydraco
tytydraco / fakeroot-tcp.sh
Created July 24, 2020 23:41
Setup fakeroot-tcp without SystemV IPC support.
#!/bin/bash
cd /tmp
wget http://ftp.debian.org/debian/pool/main/f/fakeroot/fakeroot_1.24.orig.tar.gz
tar xvf fakeroot_1.24.orig.tar.gz
cd fakeroot-1.24/
./bootstrap
./configure --prefix=/opt/fakeroot \
--libdir=/opt/fakeroot/libs \
--disable-static \
@tytydraco
tytydraco / convert_audio.sh
Last active December 30, 2022 05:31
Very simple script to convert audio files to a new format
#!/usr/bin/env bash
shopt -s globstar
FROM="opus"
TO="mp3"
OUT_DIR="Converted"
for file in **/*."$FROM"
do
@tytydraco
tytydraco / process
Created October 8, 2022 17:25
Convert audio to OPUS format from a WEBM or other container.
#!/usr/bin/env bash
# Ignore SIGINT.
trap '' SIGINT
# Given a file name, get the audio codec.
get_codec_name() {
ffprobe "$1" \
-v quiet \
-show_streams \
@tytydraco
tytydraco / degrade_audio
Created October 6, 2022 04:43
A bash script to degrade audio from a container.
#!/usr/bin/env bash
trap 'echo Ignoring' INT
filename="$(basename -- "$1")"
ext="${filename##*.}"
filenameNoExt="${filename%.*}"
dir="$(dirname "$1")"
new="$dir/degraded_$filenameNoExt.$ext"
@tytydraco
tytydraco / extract_audio
Last active October 6, 2022 04:42
A bash script to extract audio from a container.
#!/usr/bin/env bash
trap 'echo Ignoring' INT
get_codec_name() {
ffprobe "$1" \
-v quiet \
-show_streams \
-select_streams a \
-show_entries stream=codec_name \
@tytydraco
tytydraco / database_helper.dart
Created May 17, 2022 00:32
A helper class to handle basic SQLite operations in Flutter.
import 'dart:async';
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';
/// A very simple class that we recognize as SQLite-compatible
abstract class DatabaseModel {
Map<String, Object?> toMap();
}
@tytydraco
tytydraco / lc983.py
Created May 6, 2022 19:52
LC 983. Minimum Cost For Tickets
class Solution:
def mincostTickets(self, days: List[int], costs: List[int]) -> int:
# S[i] = min total cost to travel for up to i days
# S[i] =
# min(S[i-1] + costs[0], S[i-7] + costs[1], S[i-30] + costs[2]) if i is in days
# S[i-1] otherwise
# answer is S[-1]
# so either it is cheaper to check the price 7 days ago with the cost of a 7 day
# pass, or our pass is still in service, so the price does not change
@tytydraco
tytydraco / list.txt
Last active May 5, 2022 03:34
URLs for TubeSlave
Music | https://music.youtube.com/playlist?list=PLteo-8G34juksaL5jodAym7o46QBtTSiy
Creepypastas (2018) | https://www.youtube.com/playlist?list=PL376vJF9hLjiy1c4k_FxbOB8KmVb2n8n2
Creepypastas (2017) | https://www.youtube.com/playlist?list=PL376vJF9hLjhcrPjDIii4OVnTzQ1KSJYA
Creepypastas (2016) | https://www.youtube.com/playlist?list=PL376vJF9hLjgpYBHyKFuIP6QBCWBwlnG7
Creepypastas (2015) | https://www.youtube.com/playlist?list=PL376vJF9hLjiUAxsxe3MoNCVnORuMBXOn
Creepypastas (2014) | https://www.youtube.com/playlist?list=PL376vJF9hLjirE-Hj-oCqy2jWZsncR4Gz
Creepypastas | https://youtube.com/c/CreepsMcPasta
H3 Podcast | https://www.youtube.com/channel/UCLtREJY21xRfCuEKvdki1Kw
Forehead Fables | https://www.youtube.com/playlist?list=PL0AyYv4PjzJ6vGxDjrfzSbWTj3Vgjd4mh
Game Grumps Compilations | https://www.youtube.com/channel/UCNEBRUhjGcQB6fYzBfDaq0w
@tytydraco
tytydraco / Bedrock Privacy Policy
Created July 29, 2021 14:06
The official privacy policy for Bedrock.
By using Bedrock, you are aggreeing to these terms.
Bedrock requests your 1) Google Account email, 2) Google public profile information, and 3) permission to modify Bedrock's own app data in Google Drive. No information is sent anywhere except for Google's own official APIs and the Bedrock app itself.
Bedrock requests read and write access to your "minecraftWorlds" folder on your device's internal storage. Bedrock uploads and downloads files and folders from this directory (and this directory only) to Google Drive exclusively.
@tytydraco
tytydraco / chrome_keys.sh
Created June 26, 2021 05:51
Quick chrome audio control: "[" -15%; "]" +15%
#!/usr/bin/env bash
xinput test-xi2 --root 3 | \
gawk '/RawKeyRelease/ {getline; getline; print $2; fflush()}' | \
while read -r key
do
[[ "$key" -ne 34 && "$key" -ne 35 ]] && continue
VOL="+15%"
[[ "$key" -eq 34 ]] && VOL="-15%"