Skip to content

Instantly share code, notes, and snippets.

View chrisnicholas's full-sized avatar
👾

Chris Nicholas chrisnicholas

👾
View GitHub Profile
@chrisnicholas
chrisnicholas / pip_update.py
Last active August 18, 2020 17:18
A quick and dirty way to upgrade **all** currently installed pip packages. This is may break things depending on your environment so use caution.
#!/usr/bin/env python3.7
import subprocess
import json
if __name__ == "__main__":
stdout = subprocess.run(["pip", "list", "--format=json"], capture_output=True).stdout
json_out = json.loads(stdout)
for app_name in json_out:
@chrisnicholas
chrisnicholas / pip_update.py
Created August 18, 2020 17:17
A quick and dirty way to upgrade **all** currently pip packages.
#!/usr/bin/env python3.7
import subprocess
import json
if __name__ == "__main__":
stdout = subprocess.run(["pip", "list", "--format=json"], capture_output=True).stdout
json_out = json.loads(stdout)
for app_name in json_out:
@chrisnicholas
chrisnicholas / GetIpsum.py
Created April 19, 2019 17:17
Simple class for fetching custom Lorem Ipsum dummy text from https://loripsum.net. Can be quite useful for Django and Flask development.
import requests
# This may change, who knows.
API_URL = "https://loripsum.net/api/"
class GetIpsum:
"""
Generate dummy text from loripsum.net
ALL API OPTIONS - Specify in any order
@chrisnicholas
chrisnicholas / hackthebox_invite_code.py
Created October 19, 2018 18:18
Short python script which gets a valid invite code for hackthebox.eu
# ********************************************************************
# Invite Code -- https://www.hackthebox.eu
#
# Obviously this is a SPOILER and not in the spirit of the game.
#
# It is also a bit incomplete as the code does not explain *how* to get
# the API URL.
#
# However, this is the solution I came up with to automate
# the process after finding the API URL.

Keybase proof

I hereby claim:

  • I am chrisnicholas on github.
  • I am chrisnicholas (https://keybase.io/chrisnicholas) on keybase.
  • I have a public key ASAaAnqx9DTIC2nUjD38RUKv0Htq5PSUj-e9Hs0Q-FSgCAo

To claim this, I am signing this object:

@chrisnicholas
chrisnicholas / QuaverHz.py
Last active April 21, 2018 19:20
Take note duration (eg. 1/4 note) and return value in ms and Hz based on tempo.
from __future__ import division
from sys import argv
def quaverHz(argv):
'''Takes a beat subdivision and tempo and returns that subdivision's duration in ms and Hz'''
script, tempo, subdiv = argv
tempo = int(tempo)
subdiv = str(subdiv.upper())
whole_note = 240.00