Skip to content

Instantly share code, notes, and snippets.

View derek-adair's full-sized avatar
🎯
Starting a thing

Derek derek-adair

🎯
Starting a thing
View GitHub Profile
# Install / configure ubuntu
wsl –install (Takes a while)
* Make sure you create a new user.
* You may need to run `ubuntu config –default-user {username}` in powershell
## Configure Ubuntu
sudo apt update && sudo apt upgrade -yy
sudo apt install -yy python3 python3-dev build-essential libncurses-dev make
sudo ln -s /usr/bin/python3 /usr/bin/python
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && sudo python -m get-pip.py
version: '2'
services:
mysql:
image: docker.io/bitnami/mysql:8.0
volumes:
- ./db:/bitnami/mysql
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- MYSQL_USER=bn_ghost
@derek-adair
derek-adair / fetch_2020_week1.py
Created July 4, 2020 13:01
Uses new NFL API to pull down 2020 week 1 schedule
import json
import requests
url = "https://api.nfl.com/v1/reroute"
# TODO: resolve if DNT or x-domain-id are necessary. pulled them from chrome inspector
payload = 'grant_type=client_credentials'
headers = {
'DNT': '1',
'x-domain-id': '100',
This file has been truncated, but you can view the full file.
{
"name": "my-app",
"version": "0.1.0",
"problems": [
"peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1",
"peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1"
],
"dependencies": {
"@testing-library/jest-dom": {
"version": "4.2.4",
This file has been truncated, but you can view the full file.
{
"name": "my-app",
"version": "0.1.0",
"problems": [
"peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1",
"peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1"
],
"dependencies": {
"@testing-library/jest-dom": {
"version": "4.2.4",
@derek-adair
derek-adair / list-deps.py
Last active May 9, 2020 16:53
Python script to show how many dependencies each package has
import requests
import json
import lxml.html
from lxml.cssselect import CSSSelector
f = open('package.json')
packageJson = json.load(f)
for dep in packageJson['dependencies']:
response = requests.get('https://www.npmjs.com/package/{}?activeTab=dependencies'.format(dep)) tree = lxml.html.fromstring(response.text) sel = CSSSelector('#dependencies h2:first-child') results = sel(tree)
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).hotkeys=t()}(this,function(){"use strict";var e="undefined"!=typeof navigator&&0<navigator.userAgent.toLowerCase().indexOf("firefox");function t(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on".concat(t),function(){n(window.event)})}function n(e,t){for(var n=t.slice(0,t.length-1),o=0;o<n.length;o++)n[o]=e[n[o].toLowerCase()];return n}function o(e){"string"!=typeof e&&(e="");for(var t=(e=e.replace(/\s/g,"")).split(","),n=t.lastIndexOf("");0<=n;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}for(var r={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,"⇪":20,",":188,".":190,"/":191,"`":192,"-":e?173:189,"=":e?61:187,";":e?59:186,"'":222,"[":219,"]":221,"\\":220},i={"⇧":16,shift:16,"⌥":18,
{
"gameSchedule":{
"season":2018,
"seasonType":"PRE",
"week":1,
"gameId":2018080951,
"gameKey":57504,
"gameDate":"08/09/2018",
"gameTimeEastern":"19:30:00",
"gameTimeLocal":"19:30:00",
let
newState = Object.assign({}, state),
library_clips = newState.library[action.library_owner].clips,
clip_index = library_clips.indexOf(`${action.clip.user}/${action.clip.name}`)
;
library_clips.splice(clip_index, 1)
return newState
//Object.keys returns an array like ['username/clipname': {name: clipname, mp3_file:<link_to_mp3>}]
userClips = Object.keys(clips)
// filter the array to only include those that start with the username
.filter(clip => !clip.indexOf(`${username}/`))
// reduces the original object key array using object explode syntax
.reduce((obj, key)=>{
return {
// obj is exploded, its the accumulation of the reduce
...obj,
// inserts the clip into the accumulator