Skip to content

Instantly share code, notes, and snippets.

View kepstein's full-sized avatar

Kevin Epstein kepstein

View GitHub Profile
@kepstein
kepstein / jq-cheetsheet.md
Created January 21, 2022 18:15 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@kepstein
kepstein / 3xplus1.py
Created February 20, 2022 03:12
3x + 1 Math problem
num = 27
steps = 0
# while steps < 30: # use this while logic to show that it continuously loops 4,2,1. The number 30 can be changed to any arbitrary number
while num != 1:
if num % 2 != 0:
num = num * 3 + 1
else:
num = num / 2
print(num)
steps += 1
@kepstein
kepstein / secrets.py
Created March 15, 2022 02:41
Generating secure random strings
#!/usr/bin/env
# Python Docs https://docs.python.org/3/library/secrets.html
import secrets
secrets.token_hex(5).upper() # The number of actual character returned will be double the number in token_hex(n)