Skip to content

Instantly share code, notes, and snippets.

View joejag's full-sized avatar

Joe Wright joejag

View GitHub Profile
HotKeySet("!a", "Main") ;wait for ALT-a keystroke, then go to Main()
While 1
Sleep(100)
WEnd
Func Main()
AutoItSetOption( "MouseCoordMode", 0 )
WinWait( "@Alexander - Discord" )
WinActivate( "@Alexander - Discord" )

https://www.youtube.com/watch?v=LxO-6rlihSg

Composition rules

  1. Horiztonal Horizons
  • hold the camera with the horizon (no jaunty angles)
  • saves crop and loss
  1. Rule of thirds -
  • Use grid
  • if person walking, put bigger space to the side they are walking. Move/See into.
@joejag
joejag / hiking_kit.md
Last active March 6, 2023 23:10
Things to bring on an overnight hiking adventure

Pack

  • Coat, black fleece
  • extra hat + gloves
  • Boots
  • Sunglasses
  • Toothbrush etc

Done

import datetime as DT
from itertools import cycle
import csv
rota = cycle(
[
"Brown",
"Blue",
"Green + Brown",
"Blue",
Subject Start date
Brown bin day 2023-01-06
Blue bin day 2023-01-13
Green + Brown bin day 2023-01-20
Blue bin day 2023-01-27
Brown bin day 2023-02-03
Green + Blue bin day 2023-02-10
Brown bin day 2023-02-17
Blue bin day 2023-02-24
Green + Brown bin day 2023-03-03
@joejag
joejag / github_teams.py
Created October 29, 2022 11:46
Create a json of the team structure of a Github org
#!/usr/bin/env python3
# Create a JSON of every team and the members for that team
# Final file has the form {"Team 1": [{"name": "Bob Smith", "email": "bob@example.com", "login": "bobsmith"}]}
from collections import defaultdict
import os
import json
from github import Github # pip install pygithub
github_api = Github(os.environ.get("GITHUB_ACCESS_KEY"))
@joejag
joejag / birthday_paradox.py
Last active October 5, 2022 23:26
The birthday paradox. If you have 23 people, there's a 50% chance they share a birthday
from collections import Counter
from random import randrange
results = []
# Run this 10k times
for _ in range(0, 10000):
# Give me 23 random birth dates given 365 days in a year
birthdays = [randrange(365) for _ in range(23)]
# Check for any overlap

Edit Distance

Write a function that returns whether two words are exactly "one edit" away using the following signature: bool OneEditApart(string s1, string s2); An edit is:

  • Inserting one character anywhere in the word (including at the beginning and end)
  • Removing one character
  • Replacing one character

Implement a function that outputs the Look and Say sequence:

1
11
21
1211
111221
312211
13112221

2D Spiral Array

Find the pattern and complete the function: int[][] spiral(int n) where n is the size of the 2D array.

Sample Result