Skip to content

Instantly share code, notes, and snippets.

View mikedidomizio's full-sized avatar

Mike DiDomizio mikedidomizio

View GitHub Profile
@mikedidomizio
mikedidomizio / ios-multiple-discord-profiles.txt
Created January 14, 2024 19:03
How to have multiple Discord profiles on iOS device
Desktop app supports the ability to switch profiles but the iOS app does not.
To be able to use multiple Discord profiles on an iOS device without logging out one can:
1. Use the Discord app for a main profile
2. Use the Chrome browser and go to https://discord.com/login. You have to go there and not just go to discord.com because on a mobile browser it doesn't have a login link and instead wants you to download the app.
3. Log into Discord through your browser that way
4. If you need more profiles - you will need to use a different browser
@mikedidomizio
mikedidomizio / squash.sh
Created March 26, 2023 14:33
Squash all commits with new message initial commit
#!/bin/bash
# Squashes all the commits and updates the author/date of the initial commit to the current time
git reset --soft $(git rev-list --max-parents=0 HEAD)
git add -A
git commit --amend --reset-author -m "Initial commit"
@mikedidomizio
mikedidomizio / git.sh
Created December 13, 2022 21:01
Rebase branch on main with signed commits
# Fix commits that aren't signed
git rebase --exec 'git commit --amend --no-edit -n -S' -i main
@mikedidomizio
mikedidomizio / whatsapp.ts
Created November 19, 2022 14:56
WhatsApp verification, hook message receive and post back
import type { NextApiRequest, NextApiResponse } from 'next'
import axios from "axios";
// todo this was all taken from the working and converted for use with NextJS - https://glitch.com/edit/#!/fortune-aeolian-amphibian?path=app.js%3A18%3A6
if (!process.env.WHATSAPP_TOKEN || !process.env.WHATSAPP_VERIFY_TOKEN) {
throw new Error('env vars not set')
}
// Access token for your app
@mikedidomizio
mikedidomizio / hcaptcha.md
Created July 31, 2022 01:08
List of public hcaptchas
@mikedidomizio
mikedidomizio / cleanup.sh
Last active May 27, 2022 20:21
Script to delete branches that are stale and have no commits
#!/usr/bin/env bash
# Proceeds to go through remote branches and delete any branch that is over a year old and does not have a commit ahead of master
# Proceeds to output what it will delete
# ./cleanup.sh ../project-directory
# Proceeds to output and delete
# ./cleanup.sh ../project-directory --real-run
@mikedidomizio
mikedidomizio / helpful-git-aliases.sh
Last active December 13, 2022 18:46
Helpful Git aliases
# Writing new aliases
# https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases
# Checkouts master before a certain date
# Useful for when you want to check out a certain time and don't have a specific commit
# git checkout-before "2021-01-01 00:00:00"
git config alias.checkout-before '!f() { git checkout `git rev-list -n 1 --first-parent --before="$1" master`; }; f'
@mikedidomizio
mikedidomizio / delete_branches_older_than.sh
Created February 17, 2021 12:25 — forked from AvnerCohen/delete_branches_older_than.sh
Script to delete branches older than 6 months old, ignore local vs remote errors.
#!/bin/sh
ECHO='echo '
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$'); do
if [[ "$(git log $branch --since "6 months ago" | wc -l)" -eq 0 ]]; then
if [[ "$DRY_RUN" = "false" ]]; then
ECHO=""
fi
local_branch_name=$(echo "$branch" | sed 's/remotes\/origin\///')
$ECHO git branch -d $local_branch_name
@mikedidomizio
mikedidomizio / main.yml
Created January 17, 2021 02:46
Use GitHub actions to push to S3
# commit this file to .github/workflows/main.yml
# replace {{YOUR_S3_BUCKET}} with your S3 bucket and secrets.* are to be set in your GitHub repo
# default I believe is us-east-1
name: Upload Website
on:
push:
branches:
- master
jobs:
deploy:
@mikedidomizio
mikedidomizio / bmo-credit-card-calculate.js
Last active March 17, 2021 11:51
BMO credit card total amount of transactions
// loops through the credit card transactions
// proceeds to generate a map of items and the number of times it was on the statement, and total amount spent
function calculate () {
const places = new Map();
for (const i of document.querySelectorAll('td.ccTransDescription').entries()) {
var place = i[1].textContent.trim().toLowerCase();
var entries = i[1].parentNode.querySelectorAll('td.ccTransAmount')
var amount = Array.from(entries.entries())[0][1].textContent;
if (!places.has(place)) {