Skip to content

Instantly share code, notes, and snippets.

View AJamesPhillips's full-sized avatar

AJP / James Phillips AJamesPhillips

View GitHub Profile
@AJamesPhillips
AJamesPhillips / video_speed.md
Last active October 1, 2020 13:21
Speed up videos

Add the following code as a bookmark:

javascript: var videos = Array.from(document.getElementsByTagName('video')); var v = document.querySelector('video');  if (v) videos.push(v);  var t = parseFloat(prompt('Set the playback rate')); videos.forEach(v => v.playbackRate = t);

Then click it to set the video playback speed.

@AJamesPhillips
AJamesPhillips / new_password.py
Last active August 31, 2021 08:24
Crypto random password
import random;
import string;
N = 10
''.join(random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(N))
N = 5
word_file = "/usr/share/dict/words" # only works in *nix, https://stackoverflow.com/a/18835426/539490
WORDS = open(word_file).read().splitlines()
''.join(random.SystemRandom().choice(WORDS).capitalize() for _ in range(N))
@AJamesPhillips
AJamesPhillips / pub_sub.ts
Created May 22, 2021 12:51
Type safe typescript PubSub
// try it out in the playground: https://www.typescriptlang.org/play?#code/LAKFoeggCAHBXARgfQM5OQMwIYGMAuA9gE4CeAdPquCJvAHYECWh9cG6KOBJp0APAFtssaAFMAHvjH0AJqmgB5RACsxBAHzQAFAEpQAb1DQT0XK1T5o2ADY20SVLmJNEY4qgBc0A9ADaANLQTGwA1mKkhJjQwrAAugD83tragmKoqNgA5mLesYFxutAAvFoAboRMsrp+cdAAviU+9TTGpnSM+CxsCIgCQZLScgrhkdGxWtpEsEy43gEANDHpmTl5IgX6IKY+bTsm5vSWMdikbg6ITi5uHsmpK9m5J7CbJeWV1bXQAD7QDLJiTAhMSyJq2eycK6udyoPzTWZxPb7Q7HSHOaEeJrCM5iC5Qm4KYpEv5yQHA0EJfx1dY4vHogk0famNHXGHkTAkACieAAFtoWRi3kidkZtkz9qgxPgACpMNKEeD4FJFUrQAU3e4ZR66JYABi24oaBtMLTAZp2HWYrDVSH64ikMnk0FGUWek3hc2gixtl3p7mSaS1a2er1VFSqxpMosNKKs2PO6phd0Dqye+QChTe0HDnzqv3+ZPoILBdjprI8cMIM1wiLFTNjPvxMKxpwTjj9mKJxRJAKBRYpVOgNLbvvL1HN4sTHnICFQfKnW2FpnBZYxsI9dW7U-HS5MxCl8GIbAYiaweCIZCmVdmSwXSNNjPaDCtx6O7dZZ54ZDtg0dIwiroTDoHrzLe74YgGDzBummZhh8ka7HW+z7vgh5sHoQpISKu7IhYcatri27JlBaYbBmKrvBGXz5qSfbFt2K7bpW1a1oaOwNtuLa0pxXY9oWxaUl8w6EeBDITmxZh4dARYAO6rgSTTbuyTA2NIxD8lmCgAITEneWHioxokwsxCJNLJ8kwjhpo7A+4nQChaE+OwiBgX0pq2Y+kAwNg9CEPgPLuFgKliJQO4gCEancGI0AAMI+WU2CoAAsqgWRJSIhh