Skip to content

Instantly share code, notes, and snippets.

class Solution:
def romanToInt(self, s: str) -> int:
numerals = {
'I': 1,
'V': 5,
'X': 10,
'L': 50,
'C': 100,
'D': 500,
'M': 1000
@mike-pete
mike-pete / bakingConversions.py
Created June 7, 2022 06:21
Baking conversions in Python
conversions = {
'cup': 1,
'ml': 236.588,
'tbsp': 16,
'tsp': 48
}
unitAlias = {
'cups': 'cup',
'mls': 'ml',
@mike-pete
mike-pete / README.md
Created May 31, 2022 23:46
D&D Stat Roller
  1. Roll a 6 sided die 4 times.
  2. Remove the lowest dice result.
  3. Add up the remaining numbers to get an ability score.
  4. Write down this ability score on note paper.
  5. Repeat these steps until you have 6 ability scores.
@mike-pete
mike-pete / getRedditCommenters.js
Created May 16, 2022 00:13
get a list of all reddit users that commented on a post
let commenters = document.querySelectorAll('[data-testid="comment_author_link"]')
let commenterData = {}
commenters.forEach(commenter => commenterData[commenter.text] = commenter.href)
console.log(commenterData)
@mike-pete
mike-pete / verifyJWT.js
Created April 11, 2022 16:13
An example of verifying JWTs from a Cloudflare Function.
// the origonal gist that this code is based off of:
// https://gist.github.com/bcnzer/e6a7265fd368fa22ef960b17b9a76488
// these are refrences for firebase stuff:
// https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com
// https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com
export default async function verifyJWT(request) {
const encodedToken = getJwt(request)
if (encodedToken === null) {
@mike-pete
mike-pete / mouseMover.ino
Created January 15, 2022 03:44
Move the mouse back and forth to keep a computer awake
#include <DigiMouse.h>
#include <oddebug.h>
#include <osccal.h>
#include <osctune.h>
#include <usbconfig-prototype.h>
#include <usbconfig.h>
#include <usbdrv.h>
#include <usbportability.h>
void setup() {
@mike-pete
mike-pete / 0-Install-Software.md
Last active January 9, 2022 21:43
Get ready to code
@mike-pete
mike-pete / changeTerminal.md
Last active October 28, 2021 17:33
Change default terminal in VS Code

Change the default terminal in VS Code

  1. Press F1
  2. Type Terminal: Select Default Profile (or Terminal: Select Default Shell in older VS Code versions), then press Enter.
  3. Use the arrow keys to scroll to your preferred terminal (I recommend Git Bash).
  4. Press Enter to make the change.
@mike-pete
mike-pete / cheatsheet.md
Last active September 9, 2023 16:54
Git Cheat Sheet

rebase the last 4 commits: git rebase -i origin/<branch name>~4 development

clone again in a different directory: git worktree add ../the_project_2 <branch>

intereactive rebase: rebase -i origin/development

create branch: git branch

@mike-pete
mike-pete / day6.txt
Last active October 7, 2021 01:30
Mobile Friendly Day 6
1. Use this template to create a new repo named "event-landing-page"
https://github.com/gerbriel/Bootstrap-template
2. Clone your new repo to your computer
3. Create a new branch named daily-challenge
git checkout -b daily-challenge
4. Recreate the jumbotron and speaker sections according to this wireframe
https://geekwiseacademy.github.io/virtual-mobile-friendly-websites/img/event-landing-page-wireframe.jpg