Skip to content

Instantly share code, notes, and snippets.

View slashinfty's full-sized avatar

Matt Braddock slashinfty

View GitHub Profile
@slashinfty
slashinfty / roll.sh
Last active December 7, 2019 01:27
Shell script for rolling dice (#d#+#)
#! /bin/bash
if [[ $# -lt 1 ]]; then
echo "missing argument"
exit 1
fi
RANDOM=$$
roll=0
mod=0
while [[ $1 ]]
do
@slashinfty
slashinfty / tex2pdf.bat
Last active December 27, 2019 03:17
A Windows batch file for simple LaTeX PDF compiling with clean up
rem this batch file compiles all tex files to pdf files in the folder this file is in
for %%i in (*.tex) do (if not exist "%%~ni.pdf" xelatex "%%i")
rem this will delete any extraneous files from the compilation process
del *.log && del *.aux
rem this will delete original tex files and leave only pdf files - delete rem below if you want to enable
rem del *.tex
@slashinfty
slashinfty / .bash_aliases
Last active March 17, 2020 14:46
Collection of various hacky bash functions
# quick apt commands
alias upd='sudo apt update && sudo apt list --upgradable'
alias upg='sudo apt upgrade -y && sudo apt autoremove -y'
alias ins='sudo apt install'
alias prg='sudo apt purge'
alias avail='apt policy'
# adding applications to dmenu
# first parameter: name of entry
# second parameter (for add): command to launch application
// ==UserScript==
// @name Giphy Download GIF
// @version 1.0.1
// @description Allows you to download GIFs direcly from GIPHY
// @author slashinfty (originally by Yoshitura)
// @match https://*.giphy.com/gifs/*
// @match http://*.giphy.com/gifs/*
// @grant none
// @run-at document-end
// ==/UserScript==
@slashinfty
slashinfty / copy-meet-chat.js
Last active April 21, 2020 03:00
Get a list of users who have sent a chat message in a Google Meet
// To run (in Chrome):
// MUST HAVE GOOGLE MEET CHAT VISIBLE!
// Press F12 to open Developer Tools
// Click the "Console" tab
// Copy and paste the code below
function copyToClipboard(str) {
var tempInput = document.createElement("input");
tempInput.style = "position: absolute; left: -1000px; top: -1000px";
tempInput.value = str;
local i = 0
local cx = 0
local cy = 0
local p1_cx = 0
local p1_cy = 0
local p2_cx = 0
local p2_cy = 0
local drawn = 0
function drawTile(x, y)
@slashinfty
slashinfty / racetime.js
Last active June 1, 2020 14:29
Are you in a racetime.gg race? (node.js)
const fetch = require('node-fetch');
module.exports = {
getLink: async function(client, channel) {
const siteRoot = 'https://racetime.gg';
const raceSearch = await fetch(`${siteRoot}/races/data`);
const races = await raceSearch.json();
if (races.races.length === 0) client.say(channel, 'No active races');
else {
let foundRace = null;
\documentclass[t]{beamer}
\usepackage[utf8]{inputenc}
\usecolortheme{seahorse}
\usetheme{Rochester}
\usefonttheme{structuresmallcapsserif}
\beamertemplatenavigationsymbolsempty
\begin{document}
\begin{frame}
\frametitle{Monday\,-\,\today}
\begin{columns}
@slashinfty
slashinfty / inftyb0t-help.md
Last active July 11, 2020 16:59
Help document for my Twitch bot.

inftyb0t

Commands for everyone

!sml2 race

Get a random seed with common flags. Add +dx to the end if you want to race a DX seed.

!sml2 hard

@slashinfty
slashinfty / fromSGB-toSGB
Last active July 21, 2020 15:09
Nightbot commands for SGB time conversion
Suggested command name: !fromSGB
Command:
$(eval const timeToMS=b=>{let c=b.split(":").reverse(),a=1e3*parseFloat(c[0]);return 1<c.length&&(a+=6e4*parseInt(c[1])),2<c.length&&(a+=36e5*parseInt(c[2])),a},msToTime=a=>{let b=Math.floor(a/36e5%24),c=Math.floor(a/6e4%60);c=10<c?c+":":0===c?"":"0"+c+":";let d=Math.floor(a/1e3%60);d=10>d?"0"+d:d;let e=Math.trunc(a%1e3);return b=0===b?"":b+":",e=0==e?"":"."+e,b+c+d+e};msToTime(4295454*timeToMS("$(1)")/4194304);)
To add:
!commands add !fromSGB $(eval const timeToMS=b=>{let c=b.split(":").reverse(),a=1e3*parseFloat(c[0]);return 1<c.length&&(a+=6e4*parseInt(c[1])),2<c.length&&(a+=36e5*parseInt(c[2])),a},msToTime=a=>{let b=Math.floor(a/36e5%24),c=Math.floor(a/6e4%60);c=10<c?c+":":0===c?"":"0"+c+":";let d=Math.floor(a/1e3%60);d=10>d?"0"+d:d;let e=Math.trunc(a%1e3);return b=0===b?"":b+":",e=0==e?"":"."+e,b+c+d+e};msToTime(4295454*timeToMS("$(1)")/4194304);)
To edit:
!commands edit !fromSGB $(eval const timeToMS=b=>{let c=b.split(":").reverse(),a=1e3*parseFloat(c[0]);retu