Skip to content

Instantly share code, notes, and snippets.

# this program converts a floating point number from binary to decimal
# sign mantissa * 2**(exponent)
sign = 0
exponent = '10100'
mantissa = '0110101110'
# convert binary to decimal
def bin2dec(n):
##########
# GitHub #
##########
GitHub's APIs are AWESOME! They give you access to soooo much information, it's insane!
Nearly everything you want to know you can access via their APIs.
This includes things like: name, username, profile picture, repos, *email*, user events, *followers/following*, etc.
The main practical restrictions come from the API rate limiting.
Unauthenticated requests (what I used in my project) are limited to something like 50 requests per IP per hour.
@mike-pete
mike-pete / wait.js
Last active August 11, 2020 19:05
wait.js
/**
* Wrapper for setTimeout
* @param {number} timeDelay Time to wait (ms)
* @returns {promise} Empty promise that is resolved after the delay
*/
async function wait(timeDelay){
return new Promise(
resolve => setTimeout(
() => resolve(), timeDelay
)
@mike-pete
mike-pete / index.html
Last active January 23, 2021 21:17
Geekwise Nav Bar
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
@mike-pete
mike-pete / index.html
Last active February 3, 2021 03:58
Day 5 Daily Challenge
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
@mike-pete
mike-pete / Step 0 - Prep
Last active June 8, 2022 22:26
Git-Bash Cheatsheet
// install git-bash
https://git-scm.com/downloads
// Sign up with Github
https://github.com/join
@mike-pete
mike-pete / DailyChallengeV9.txt
Last active March 23, 2021 02:53
Daily challenge to use folders instead of filenames for struct your site
Go to github.com and create a new repository named "final-project" (https://github.com/new)
Clone your final-project repository using SSH
Add the following to your final-project folder
Folders:
about
contact
css
@mike-pete
mike-pete / react-notes.js
Last active May 12, 2021 01:13
React notes
// new react app
npx create-react-app
// install sass
npm install node-sass --save
// install react router
npm install react-router
// install gh-pages https://dev.to/yuribenjamin/how-to-deploy-react-app-in-github-pages-2a1f
@mike-pete
mike-pete / jwtCheck.py
Created May 19, 2021 17:36
AWS Cognito JWT Validation
# https://renzolucioni.com/verifying-jwts-with-jwks-and-pyjwt/
import jwt
import json
import urllib.request
# config
region = ''
userpoolID = ''
@mike-pete
mike-pete / getDataAtPath.js
Created August 19, 2021 17:47
Get nested data at path (loop vs recursion)
const data = {
a:{
b:{
c:{"neat":"right!?"}
}
}
}
function getDataAtPath(path, currentData){