Skip to content

Instantly share code, notes, and snippets.

View moonexpr's full-sized avatar
📚
Reading Lotus Sutta

John moonexpr

📚
Reading Lotus Sutta
View GitHub Profile
@moonexpr
moonexpr / wine_killall
Created September 22, 2022 00:48
wine_killall: Terminates all wine instances
#!/usr/bin/bash
# From:
# https://askubuntu.com/questions/52341/how-to-kill-wine-processes-when-they-crash-or-are-going-to-crash/732320#732320
wine_cellar="${HOME}/.local/share/wine"
if (($#)); then
if [[ -e "${wine_cellar}/$1" ]]; then
WINEPREFIX="${wine_cellar}/$1"

Packages:

  1. Terminal emulator: apt install terminology
  2. Text viewer: apt install catbat && ln -s $(which batcat) /usr/bin/bat
  3. Shell program: apt install fish-shell
  4. Icon browser: apt install gtk-4-examples
  5. Text editor: apt install neovim && abbr nvim n
  6. Development Tooling: apt install git gh

Repositories:

  1. GitHub CLI: https://github.com/cli/cli
@moonexpr
moonexpr / curl_resolve
Last active September 17, 2022 18:44
curl_resolve: Resolves a URL unil it no longer redirects, dumps it's final URL.
#!/usr/bin/bash
if [[ $# < 1 ]]; then
echo "Resovles a URL unil it no longer redirects, dumps it's final URL."
echo "usage: curl_resolve <url>"
exit 2
fi
MAX_REDIRECTS=3
curl --max-redirs $MAX_REDIRECTS $1 -s -L -I -o /dev/null -w '%{url_effective}'
#include "mathlib.h"
/**
* Vector4 Class
*/
Vector4::Vector4 (void)
{
this->x = 0;
this->y = 0;
@moonexpr
moonexpr / bash_diligence
Last active October 17, 2022 17:23
bash_diligence <program>: Allows you to run a program in the background while telling you if it fails.
#!/bin/bash
# notify: Instantiates a new push notification.
# $1 string title
# $2 string body
notify()
{
NOTIFY_OPTS="-a $0 -i utilities-terminal -t 8000"
notify-send ${NOTIFY_OPTS} "$1" "$2"
}
@moonexpr
moonexpr / screencap
Last active November 12, 2022 19:26
Screencap: An quick and simple image upload utility
#!/bin/bash
# cfg: Folder relative to your keyboard public room.
public_path="/sharex/$(date +"%b%Y")"
######### Do not touch. ##################################################
## setup: detect environment and define globals
TMP_FILE="/tmp/push-img.png"
@moonexpr
moonexpr / canvas.css
Last active January 25, 2023 16:27
A couple CSS patching, making the Canvas LMS much easier to use.
.ic-Layout-watermark {
background: linear-gradient(0deg, #f5f6f9, rgba(255, 255, 255, .8) 60%), url(https://www.iastate.edu/files/styles/banner/public/images/2022-06/HP_CampusRainbow22.jpg) fixed !important;
background-blend-mode: normal;
width: calc(100vw - 54px);
}
.quiz-header h1, .quiz-header h2 {
margin-top: 0;
font-weight: normal !important;
font-family: "Cooper BlkHd BT" !important;
font-size: 2rem !important;
@moonexpr
moonexpr / vdf-validator.py
Created April 6, 2022 02:02
Small curly-brace validator for anything. (Used for Valve Data Format)
#!/usr/bin/env python
import sys
import os
counter = 0
with open(sys.argv[1], "r") as fd:
while True:
c = fd.read(1)
if (c == '{'):
counter += 1
@moonexpr
moonexpr / generate_index.sh
Last active October 20, 2022 14:08
emoji web index generator✨ - generates a static index.html page of a web directory (@chandara.keybase.pub)
#!/usr/bin/env bash
shopt -s extglob
# helper: logging shortcut function
[[ -z $LOG_PREFIX ]] && LOG_PREFIX=""
log()
{
echo -e "${LOG_PREFIX}$1"
}
@moonexpr
moonexpr / bot-reporter.py
Last active October 14, 2021 17:22
TF2 Bot Account Reporter
#!/usr/bin/env python3
import os
import requests
import json
REASON = 'The account associated with the report is ran by cathook (https://github.com/nullworks/cathook), this account uses third-party software to cheat on Valve matchmaking servers and prevents legitimate players from enjoying the game.'
# Get these from web cookies
AUTH_SESSION_ID = ""