Skip to content

Instantly share code, notes, and snippets.

View y4my4my4m's full-sized avatar
🏠
Working from home

チャールズ y4my4my4m

🏠
Working from home
View GitHub Profile
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/addons/p5.dom.min.js"></script>
<script type="text/javascript">
var possibleChoice = ["rock","paper","scissor"];
var currentSelection;
var playerOneScore = 0;
var playerTwoScore = 0;
var c;
@y4my4my4m
y4my4my4m / sxosbruteforceshitscript.js
Created June 24, 2018 16:18
sxos bruteforce shit script
function makeid() {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
for (var i = 0; i < 12; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
@y4my4my4m
y4my4my4m / DownloadPlaylist-ExtractDesc.sh
Last active October 24, 2022 00:39
Auto extract youtube description and parse it to relevant area only
#download playlist
youtube-dl -x --audio-format=mp3 -ciw -o "%(title)s.%(ext)s" -v https://www.youtube.com/playlist\?list\=PL06diOotXAJLAAHBY7kIUm5GQwm2ZinOz --add-metadata --write-description
#sed ranged pattern string in a for loop
for i in *.description; do sed '1,/► Music Credit:/d;/––– ♪♫/,$d' "$i" > "$i%.description"_parsed.description; done
#remove original .description files
rm -rf *.description
#rename _parsed
@y4my4my4m
y4my4my4m / UntitledNESHomebrew.nes.hex
Created September 7, 2020 10:34
UntitledNESHomebrew.nes.hex
This file has been truncated, but you can view the full file.
00000000: 4e45 531a 2000 e310 0000 0000 0000 0000 NES. ...........
00000010: 0e44 4444 4444 4444 4444 4444 4444 4444 .DDDDDDDDDDDDDDD
00000020: 4444 4444 4444 4444 4444 4444 4444 4444 DDDDDDDDDDDDDDDD
00000030: 4444 4444 4444 4444 4444 4444 4444 4444 DDDDDDDDDDDDDDDD
00000040: 4444 4444 4444 4444 4444 4444 4444 4444 DDDDDDDDDDDDDDDD
00000050: 0c2a 4444 4444 4444 4444 0000 4444 4428 .*DDDDDDDD..DDD(
00000060: 0644 4442 4440 4444 4440 4444 4400 2e44 .DDBD@DDD@DDD..D
00000070: 4444 0824 422e 4444 4444 4000 0204 0c00 DD.$B.DDDD@.....
00000080: 2444 4444 2044 2844 4444 2a28 2a44 4444 $DDD D(DDD*(*DDD
00000090: 4444 4444 4444 4244 2a44 442e 2c44 4444 DDDDDDBD*DD.,DDD
@y4my4my4m
y4my4my4m / discord-install.sh
Created February 14, 2023 03:31
A quick script to install discord for Arch. Sometimes discord need you to install the udpate as a .tar.gz. This script allows you to auto-install it. Just call this script from where you've downloaded the discord-0.0.25.tar.gz file and call it like "sudo discord-install.sh 25"
#!/bin/sh
set -e
if [ -z "$1" ] || ! [ "$1" -eq "$1" ] 2>/dev/null; then
echo "Invalid or missing argument. Please provide a valid number."
exit 1
fi
if sudo rm -rf /opt/Discord; then
echo "Removed old Discord installation."
else
echo "Failed to remove old Discord installation. Aborting."
@y4my4my4m
y4my4my4m / asus-brightness-down
Created May 10, 2023 09:11
Asus Zenbook Duo screenpad brightness control on linux
# /etc/acpi/events/asus-keyboard-backlight-up
# This is called when the user presses the key brightness
# up button and calls /etc/acpi/asus-keyboard-backlight.sh for
# further processing.
# sudo ln -s /path/to/file /etc/acpi/events/asus-brightness-down
event=video/brightnessdown BRTDN 00000087 00000000
action=/etc/acpi/asus-brightness.sh
@y4my4my4m
y4my4my4m / downloader.sh
Created May 14, 2023 17:35
Recursive wget downloader
#!/bin/bash
base_url="https://files.artpacks.org"
index_page="/"
# Function to process a URL
process_url() {
local url=$1
if [[ $url =~ \.zip$ ]]; then # if it's a zip file
wget "${base_url}${url}"
@y4my4my4m
y4my4my4m / loop_ansi.sh
Last active May 15, 2023 08:16
ANSI Art Browser
#!/bin/bash
# ANSi art function
function ANSi() {
tr '\0' ' ' < "$1" | iconv -f CP437 -t UTF8
}
# Check if a directory was provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 directory"
@y4my4my4m
y4my4my4m / ffconv.sh
Created September 9, 2023 07:06
FFmpeg compress to filesize
#!/bin/bash
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <input_file> <output_file> [target_size_MB]"
exit 1
fi
input="$1"
output="$2"
target_size=${3:-20} # Default to 20MB if not specified