Skip to content

Instantly share code, notes, and snippets.

### extract videos as mp3 files
youtube-dl -x --audio-format mp3 <video link>
### get highest resolution audio & video
To download a video, you type the URL after the command like so:
youtube-dl <video link>
To select the video quality, first use the -F option to list the available formats, here’s an example,
@RandomCriticalAnalysis
RandomCriticalAnalysis / state_fiscal_test_score_correlation_example.R
Created May 7, 2018 14:36
Snippet to create correlation plot by state between school test scores and per pupil fiscal measures
library(dplyr)
library(reshape2)
library(ggplot2)
DataPath="." # you may need to update this if not working from same path
setwd(DataPath)
# Data from version 2.0 of covariates and pooled score estimates from SEDA
# https://cepa.stanford.edu/seda/data-archive
@grossbart
grossbart / nix.md
Last active February 28, 2025 04:15
Nix on macOS

Nix

Nix is a powerful package manager that makes package management reliable and reproducible. It provides atomic upgrades and rollbacks, side-by-side installation of multiple versions of a package, multi-user package management and easy setup of build environments.

Installation

#!/usr/bin/env python3
import sys
import subprocess as sp
from pathlib import Path
from argparse import ArgumentParser
from configparser import ConfigParser
def ssh(host, cmd):
return sp.check_output(['ssh', host, cmd]).strip().decode()
#!/usr/bin/env python3
from argparse import ArgumentParser
from pathlib import Path
from datetime import datetime, timedelta
import subprocess
from math import log10, sqrt
def prune(seq, key, dist):
pruned = []
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active April 29, 2025 21:58 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Exporting your 2FA tokens from Authy to transfer them into another 2FA application

IMPORTANT - Update regarding deprecation of Authy desktop apps

Past August 2024, Authy stopped supported the desktop version of their apps:
See Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August for details.

And indeed, after a while, Authy changed something in their backend which now prevents the old desktop app from logging in. If you are already logged in, then you are in luck, and you can follow the instructions below to export your tokens.

If you are not logged in anymore, but can find a backup of the necessary files, then restore those files, and re-install Authy 2.2.3 following the instructions below, and it should work as expected.

WannaCry|WannaDecrypt0r NSA-Cyberweapon-Powered Ransomware Worm

  • Virus Name: WannaCrypt, WannaCry, WanaCrypt0r, WCrypt, WCRY
  • Vector: All Windows versions before Windows 10 are vulnerable if not patched for MS-17-010. It uses EternalBlue MS17-010 to propagate.
  • Ransom: between $300 to $600. There is code to 'rm' (delete) files in the virus. Seems to reset if the virus crashes.
  • Backdooring: The worm loops through every RDP session on a system to run the ransomware as that user. It also installs the DOUBLEPULSAR backdoor. It corrupts shadow volumes to make recovery harder. (source: malwarebytes)
  • Kill switch: If the website www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com is up the virus exits instead of infecting the host. (source: malwarebytes). This domain has been sinkholed, stopping the spread of the worm. Will not work if proxied (source).

update: A minor variant of the viru

@JonnyWong16
JonnyWong16 / sync_playlists_to_users.py
Last active April 8, 2025 20:09
Sync Plex playlists to shared users.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Description: Sync Plex playlists to shared users.
# Author: /u/SwiftPanda16
# Requires: plexapi
from plexapi.exceptions import NotFound
from plexapi.server import PlexServer

The current kernel/drivers of Fedora 24 do not support the Wifi chip used on my Mac Book Pro. Proprietary Broadcom drivers are packaged and available in the rpmfusion repo.

Verify that your card is a Broadcom using: lspci -vnn -d 14e4:

Sample output:

02:00.0 Network controller [0280]: Broadcom Corporation BCM4360 802.11ac Wireless Network Adapter [14e4:43a0] (rev 03)

Install

Install the rpmfusion repo, note only "nonfree" is required, as the Broadcom Driver is proprietry: http://rpmfusion.org/

@flacle
flacle / sortRecipientsAlphabeticallyV1.scpt
Last active December 8, 2023 23:11
Apple Script for the Mail App to sort email recipients alphabetically in the To, Cc, and Bcc fields. For when you don't wan't to give subliminal preference to coworkers ;)
(*
Author: Francis Laclé
Version: 1.0
Date: January 4 2016
Description: The purpose of this script is to sort email recipients alphabetically in the To, Cc, and Bcc fields.
Motivation: For cases when you don't want to give subliminal preference to coworkers in your organization ;)
Requirements: Apple Mail, OSX El Capitan
Installation and usage:
1) Use "Run AppleScript" as a new Service in Automator.
2) Choose "Service receives no input in Mail.app".