Skip to content

Instantly share code, notes, and snippets.

View atlc's full-sized avatar

Andrew Cartwright atlc

View GitHub Profile
@atlc
atlc / ClearOldFiles.bat
Last active January 22, 2019 15:26
Delete files on the desktop older than (90) days
ForFiles /p "C:\Users\%USERNAME%\Desktop" /s /d -90 /c "cmd /c del /F /Q @file"
ForFiles /p "C:\Users\%USERNAME%\Downloads" /s /d -30 /c "cmd /c del /F /Q @file"
@atlc
atlc / CalculatorRegex.swift
Created March 19, 2019 12:54
Demonstration of a regex that parses through what should and should not be valid calculator input
import Foundation
extension Array where Element: Hashable {
func difference(from other: [Element]) -> [Element] {
let thisSet = Set(self)
let otherSet = Set(other)
return Array(thisSet.symmetricDifference(otherSet))
}
}
@atlc
atlc / resize-images.sh
Created August 16, 2019 13:43 — forked from kazzkiq/resize-images.sh
[bash] Resize image and create thumbnail with ImageMagick
INDEX_RESIZE=0
for file in ./*.jpg; do
[ -e "$file" ] || continue
convert $file -resize 1000x1000^ $file
let INDEX_RESIZE=$(expr $INDEX_RESIZE+1)
done
INDEX_THUMBNAIL=0
for file in ./*.jpg; do
[ -e "$file" ] || continue
#🎛️=====================================================================
#🖼️cOPyRigHT🔏2017🚣‍♀️-🎦presENt💇‍♀️ChOCOlATey🏊‍♂️sOFTwaRE,↖️iNC,🏣AnD🎂tHE
#🌠OrIGiNaL🧛‍♂️aUthors/CoNTRibuTORs📂FROM🃏chocoLAtEyGAllErY
#😆CopyRIGhT🎄2011⚙️-🔵2017😵rEAlDIMeNsiONs♒SofTWARe,🙈llc,🍐AnD⬇️The
#🚊OrIGiNaL🉑AuThOrs/CONTrIBuTOrs🛏️FROM🐔chOcOlAtEygalLerY
#♒aT🕯️hTTpS://giTHub.COM/cHOCOlAtey/cHoCOlAtEY.OrG
#
#♌lIceNSEd👎UNder🎨The🔤APachE👨‍👨‍👧‍👦LiCense,☺️verSiON💸2.0🗣️(the🏭"lIcENsE");
#🌍yoU♉May😜NOt🚛Use🥌this🚀FILE🐯eXcept✌️In🚃cOmpLIaNCe🌫️wiTH👻the🧚‍♂️lICENse.
#🐂You🌠maY🐠obTAiN😤a😵COPy🔰OF🌧️The📑lIceNse👩‍✈️at
@atlc
atlc / AdminConsoleToSQL.js
Last active February 22, 2020 02:38
IIFE that pulls the firmID and support status from the admin console, to create a SQL statement to import into the new database
(function() {
let users = [...$('#usersTable')[0].firstElementChild.children];
users.splice(0,1);
let queryString = "INSERT INTO users (firmid, password, onSupport) values ";
function parseBoolFrom(text) { return text === "Yes" ? true : false; }
users.forEach(usr => {
firmId = usr.firstElementChild.innerText;
@atlc
atlc / pizza.js
Created April 14, 2020 22:34
Retrieves a json body of the few thousand most common pizza topping combos. This fetches, flattens, and sorts the collection into a Map, and returns the top 20 individual toppings. Solution is 280B.
import f from 'node-fetch';
let M=new Map();
f('https://www.olo.com/pizzas.json').then(r=>r.json()).then(p=>{
p.forEach(c=>[...c.toppings].forEach(c=>!M.has(c)?M.set(c,0):M.set(c,M.get(c)+1)));
console.log([...M.entries()].sort((a,b)=>a[1]>b[1]?-1:a[1]<b[1]?1:0).splice(0,20));
});
// Returns this:
/*
[
@atlc
atlc / InstallationEssentials.sh
Last active May 24, 2020 03:31
Installing my normally used devtools, media programs on Debian-based systems
# Add other repos, update package listings, upgrade OS if available
sudo add-apt-repository multiverse
sudo add-apt-repository ppa:obsproject/obs-studio
sudo add-apt-repository ppa:otto-kesselgulasch/gimp
sudo add-apt-repository ppa:ubuntuhandbook1/audacity
sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
curl https://build.opensuse.org/projects/home:manuelschneid3r/public_key | sudo apt-key add -
echo 'deb http://download.opensuse.org/repositories/home:/manuelschneid3r/xUbuntu_19.04/ /' | sudo tee /etc/apt/sources.list.d/home:manuelschneid3r.list
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
@atlc
atlc / test.sh
Last active December 9, 2021 22:02
Boilerplate Batteries Included
function fullstack () {
if [ "$#" -eq 0 ] # If no arguments are provided with the function call just clone the repo as-is
then
git clone git@github.com:covalence-io/barebones-react-typescript-express.git
else
# Clone boilerplate with the first argument as the directory name & cd into that directory
git clone git@github.com:covalence-io/barebones-react-typescript-express.git $1 && cd $1
# Delete the git directory and reinitialize project as a git repo
rm -rf .git && git init
A🐝c🐝c🐝o🐝r🐝d🐝i🐝n🐝g🐝 🐝t🐝o🐝 🐝a🐝l🐝l🐝 🐝k🐝n🐝o🐝w🐝n🐝 🐝l🐝a🐝w🐝s🐝
🐝o🐝f🐝 🐝a🐝v🐝i🐝a🐝t🐝i🐝o🐝n🐝,🐝
🐝
🐝 🐝 🐝
🐝t🐝h🐝e🐝r🐝e🐝 🐝i🐝s🐝 🐝n🐝o🐝 🐝w🐝a🐝y🐝 🐝a🐝 🐝b🐝e🐝e🐝
🐝s🐝h🐝o🐝u🐝l🐝d🐝 🐝b🐝e🐝 🐝a🐝b🐝l🐝e🐝 🐝t🐝o🐝 🐝f🐝l🐝y🐝.🐝
🐝
🐝 🐝 🐝
🐝I🐝t🐝s🐝 🐝w🐝i🐝n🐝g🐝s🐝 🐝a🐝r🐝e🐝 🐝t🐝o🐝o🐝 🐝s🐝m🐝a🐝l🐝l🐝 🐝t🐝o🐝 🐝g🐝e🐝t🐝
🐝i🐝t🐝s🐝 🐝f🐝a🐝t🐝 🐝l🐝i🐝t🐝t🐝l🐝e🐝 🐝b🐝o🐝d🐝y🐝 🐝o🐝f🐝f🐝 🐝t🐝h🐝e🐝 🐝g🐝r🐝o🐝u🐝n🐝d🐝.🐝
javascript:(() => { const solution = JSON.parse(localStorage.getItem("nyt-wordle-state")).solution; const realDoc = document.body.lastElementChild["$keyboard"]["$keyboard"]; [...solution].forEach(char => { const button = realDoc.querySelector(`button[data-key="${char}"]`); button.click() }); const enter = realDoc.querySelector(`button[data-key="%E2%86%B5"]`); enter.click(); })()