Skip to content

Instantly share code, notes, and snippets.

View Pigpog's full-sized avatar

Pigpog

View GitHub Profile
@Pigpog
Pigpog / kc.sh
Last active July 5, 2022 18:53
KissCartoon.app scraper bash script using dmenu and mpv
#!/bin/bash
# Your search on the kisscartoon website
query="$(echo "" | dmenu -p "Search:" | tr ' ' '+')";
[ -z "$query" ] && exit;
# Each search result as HTML elements, containing names and URLs of shows
results="$(curl --silent "https://kisscartoon.app/?s=$query" | grep -F 'oldtitle')";
# The name of the result you chose
@Pigpog
Pigpog / wallpaper
Last active August 30, 2021 17:12
Multi-monitor wallpaper generator. One image per monitor.
#!/bin/bash
# Multi-monitor wallpaper generator
# Requires imagemagick, xrandr, feh
# Usage: pipe a list of images to this script
# Example: ls ~/Pictures/*.JPG | sort -R | sh wallpaper
{
# ignore first line
read -u 3 -r ign;
# reading from xrandr piped in last line
@Pigpog
Pigpog / section.sh
Created August 1, 2021 06:35
Shell script that performs the same task as the Cisco IOS command "section"
#!/bin/sh
#usage: cat file | section PATTERN
grep "$1" -A9999 -m1 | grep '^[[:space:]]*$' -B9999 -A0 -m1 <&0
@Pigpog
Pigpog / mpdrp.sh
Last active January 5, 2022 01:47
Music Player Daemon Discord rich presence shell script
#!/bin/dash
# MPD Discord Rich Presence
# Requires github.com/Pigpog/discord-rich-presence-cli
timecalc(){
echo "$(date +'%s') + ((($3 * 60) + $4) - (($1 * 60) + $2))" | bc
}
{
# Application ID
@Pigpog
Pigpog / currconv.sh
Created April 25, 2021 05:46
Simple UNIX shell script for currency conversion
#!/bin/sh
[ -z $2 ] || [ ! -z $4 ] && echo "Usage: currconv FROM TO [AMOUNT]" && exit;
# Parameters must be uppercase
FROM=$(echo $1 | tr 'a-z' 'A-Z' );
TO=$(echo $2 | tr 'a-z' 'A-Z' );
# SAMPLE: {"base":"CAD","rates":{"USD":0.8010888328},"date":"2021-04-23"}
RESPONSE="$(curl -s --http2 "https://api.ratesapi.io/api/latest?base=$FROM&symbols=$TO")";
@Pigpog
Pigpog / skipdetect.sh
Last active October 12, 2023 09:25
FOR MPD - Skips songs you don't like. Uses a per-song score, calculated based on whether you skip the song or let it play. The only dependency is MPC, as this script is almost entirely BASH. When the next song's score is negative, the script "rolls the dice" and if the score is <= the dice roll, it will skip it when it comes on.
#!/bin/bash
# Automatically skips songs you dont like
# Skipping a song decreases its score
# Playing it for >15 seconds increases it
# Songs are skipped randomly based on their score
# Location of database file
DBFILE=~/scripts/database
@Pigpog
Pigpog / d2l_dark
Last active October 15, 2021 18:24
dark theme for the d2l lms
// ==UserScript==
// @name D2L Dark Theme
// @version 0.1
// @description A dark theme for D2L
// @author Jared
// @match https://*.desire2learn.com/*
// @exclude https://*.desire2learn.com/d2l/lms/selfassess/*
// @exclude https://*.desire2learn.com/content/*
// @grant none
// ==/UserScript==
@Pigpog
Pigpog / Simple Upload Server
Created August 28, 2018 04:07
A very simple upload server for nodejs.
const express = require('express');
const fileUpload = require('express-fileupload');
const app = express();
// default options
app.use(fileUpload());
app.get("/upload", function (req, res, next) {
console.log(req.connection.remoteAddress)
try {
@Pigpog
Pigpog / Rabb.it_squares.js
Last active August 30, 2018 04:07
Tampermonkey script to make https://rabb.it video calls square instead of round.
// ==UserScript==
// @name Rabb.it square
// @namespace https://github.com/Pigpog
// @version 0.1
// @description change rabb.it video calls to squares instead of circles.
// @author Pigpog
// @match https://www.rabb.it/*
// @grant none
// ==/UserScript==
@Pigpog
Pigpog / Telegram_Dark_Theme.js
Last active October 27, 2018 15:35
Dark theme Tampermonkey script for telegram web https://web.telegram.org/
// ==UserScript==
// @name telegram dark theme
// @namespace https://github.com/Pigpog
// @version 0.1
// @description Telegram Web Dark Theme
// @author Pigpog
// @match https://web.telegram.org/
// @grant none
// ==/UserScript==