Skip to content

Instantly share code, notes, and snippets.

@djsegal
djsegal / Denglisch
Created April 27, 2024 12:38
A bookmarklet for loading German subtitles on Netflix using Language Reactor
javascript:(function() { function setTracks() { let video = document.querySelector('video'); if (!video || !window.lln || !window.lln.vidMan) return; let isGoodTrack = ( window.lln.setMan.sourceLanguageCode === "de" && window.lln.setMan.translationLanguageCode === "en" ); if (!isGoodTrack) { window.lln.vidMan.setAudioTrack("A:2:1;2;de;0;0;"); window.lln.vidMan.setSubtitleTrack("ASR_A:2:1;2;de;0;0;"); video.pause(); return; } let subsContent = document.querySelector("#lln-subs-content"); if (subsContent && subsContent.textContent.trim() === "- Loading subtitles, please wait... -") { if (!video.paused) video.pause(); setTimeout(setTracks, 1000); return; } if (video.paused) video.play(); } function waitForLLN(tries = 0) { if (document.querySelector('video') && window.lln && window.lln.vidMan) { setTracks(); return; } if (tries > 30) { console.error("Custom language connector failed."); return; } setTi
@djsegal
djsegal / custom_setup_language_reactor_for_german.js
Last active April 15, 2024 22:18
File for robustly loading language reactor with german subtitles
let isRepairingTracks = false;
let wasPlaying = false;
let videoLoaded = false;
let isWaiting = false;
function setTracks() {
if (!document.querySelector('video')) {
return;
}
@djsegal
djsegal / pdf_to_json.py
Last active April 8, 2024 17:16
Convert PDF of CSV file to JSON with hardcoded keys for each entry
import fitz # PyMuPDF
import json
def pdf_to_json(pdf_path, json_path):
doc = fitz.open(pdf_path)
data_list = []
for page_num in range(len(doc)):
page = doc.load_page(page_num)
text = page.get_text().replace("а́\n-", "а́-")
@djsegal
djsegal / install_jupyter_notebook_on_aws.md
Created October 14, 2017 00:44 — forked from giantryansaul/install_jupyter_notebook_on_aws.md
Run Jupyter from an amazon free tier AWS server

Installing Jupyter notebook to AWS

This is an early draft of this guide, which currently does not include any screenshots. I may be making a lot of assumptions about what you do or do not know in this guide and so I welcome any constructive criticism to help make it more useful. Please feel free to fork this guide and annotate it where it does not work, I would welcome any pull requests to improve this documentation.

Setup amazon linux server (free tier)

  • From Amazon's EC2 page, go to Launch Instance
  • Choose an Amazon Linux 64-bit server and continue
  • Select t2.micro (this is the free tier)
  • Continue to the Add Storage page and adjust this up to 30GB if you're so inclined (default is 8GB, which is plenty)
  • Tag your instance with a name like "notebook"
@djsegal
djsegal / Restoration.lua
Last active May 3, 2021 11:04
Example resto druid file for maxdps addon
function()
local BL = {
Wrath = 5176,
Starfire = 197628,
EclipseLunar = 48518,
EclipseSolar = 48517,
Starsurge = 197626,
Sunfire = 93402,
Moonfire = 8921,
@djsegal
djsegal / Balance.lua
Last active April 29, 2021 21:52
Example boomkin simple rotation
function()
local BL = {
Wrath = 190984,
Starfire = 194153,
EclipseSolar = 48517,
EclipseLunar = 48518,
Starsurge = 78674,
Starfall = 191034,
Sunfire = 93402,
@djsegal
djsegal / 10000-MTV-Music-Artists-page-1.csv
Created October 13, 2020 22:29 — forked from mbejda/10000-MTV-Music-Artists-page-1.csv
10,000 MTV's Top Music Artists. Great dataset for machine learning, research and analysis. (name,facebook,twitter,website,genre,mtv).
name facebook twitter website genre mtv
Adele http://www.facebook.com/9770929278 http://www.twitter.com/officialadele Pop http://www.mtv.com/artists/adele/biography
Joey + Rory http://www.facebook.com/15044507815 http://www.twitter.com/joeyandrory Country http://www.cmt.com/artists/joey-rory/biography
Draaco Aventura http://www.facebook.com/856796091053581 http://www.twitter.com/DraacoAventura http://www.bandpage.com/draacoaventura Pop Latino http://www.mtv.com/artists/draaco-aventura/biography
Justin Bieber http://www.facebook.com/309570926875 http://www.twitter.com/justinbieber http://www.justinbiebermusic.com Pop http://www.mtv.com/artists/justin-bieber/biography
Peer van Mladen http://www.facebook.com/264487966 http://www.twitter.com/Predrag_Jugovic http://pejaintergroup.eu/Peer_van_Mladen.html House http://www.mtv.com/artists/peer-van-mladen/biography
Chris Janson http://www.facebook.com/296647641825 http://www.twitter.com/janson_chris http://www.chrisjanson.com Country http://www.cmt.com/a
@djsegal
djsegal / Fusion Energy.ipynb
Created June 6, 2020 22:54
Comparing Pulsed and Steady-State Tokamaks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@djsegal
djsegal / covid-seir.ipynb
Last active May 9, 2020 08:06
A Live SEIR Model for Covid-19 with Error Bars in Julia
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@djsegal
djsegal / colors.jl
Created May 8, 2020 00:05
Simple color parser for hex and HTML colors to RGB array
global_colors = Dict(
"aliceblue" => [240, 248, 255],
"antiquewhite" => [250, 235, 215],
"aqua" => [0, 255, 255],
"aquamarine" => [127, 255, 212],
"azure" => [240, 255, 255],
"beige" => [245, 245, 220],
"bisque" => [255, 228, 196],
"black" => [0, 0, 0],
"blanchedalmond" => [255, 235, 205],