This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Script to extract video files written by the BMW Drive Recorder in my 2024 model | |
and rename them using the date and time in the directory names that it writes | |
into USB storage. | |
This is free and unencumbered software released into the public domain and comes | |
with no warranties. | |
Requirements: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
If you're viewing this on GitHub Gist, see a full guide, including React Router examples at: | |
https://antrikshy.com/code/painless-partitioned-localstorage-with-namespaces-react-router | |
*/ | |
export default class PersistenceHandler { | |
constructor(prefix="Project-Name") { | |
this.prefix = prefix; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import signal | |
import sys | |
def _handle_interrupt(signum, _): | |
signal.signal(signum, signal.SIG_IGN) | |
# Any cleanup steps go here | |
sys.exit(signal.SIGINT) | |
signal.signal(signal.SIGINT, _handle_interrupt) | |
# Rest of script... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from collections import Counter | |
have_tally = {} | |
want_tally = {} | |
# Get the dataset at insights.stackoverflow.com/survey | |
path_to_datum = '/path/to/downloaded/developer_survey_2019/survey_results_public.csv' | |
# This *should* work without too much modification with SO survey datasets from other |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare -a arr=("google.com" "facebook.com" | |
"amazon.com" "yahoo.com" "flickr.com" | |
"youtube.com" "twitter.com" "reddit.com") # etc etc | |
for i in "${arr[@]}" | |
do | |
echo "$i" | |
curl -L --silent "$i" | grep -E "hiring|jobs" | |
# Maybe even look for easter eggs this way! | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import math | |
# Configure paths to your dataset files here | |
DATASET_FILE = 'data.csv' | |
FILE_TRAIN = 'train.csv' | |
FILE_VALID = 'validation.csv' | |
FILE_TESTS = 'test.csv' | |
# Set to true if you want to copy first line from main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def majority_element(a): | |
n = len(a) | |
if n == 1: | |
return a[0] | |
if n == 0: | |
return None | |
k = n/2 | |
elem1 = majority_element(a[:k]) | |
elem2 = majority_element(a[k+1:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Goes in /etc/nginx/conf.d/ | |
upstream quibbler { | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 0.0.0.0:80; | |
server_name quibbler.co www.quibbler.co; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Goes in /etc/init/ | |
description "Blah server" | |
start on startup | |
start on filesystem and started networking | |
stop on shutdown | |
respawn | |
chdir /home/username/folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os, sys, subprocess, time | |
import filecmp as fc | |
# -------------------------------------------------------------------------------------------------------- | |
# Backport of Python 2.7's subprocess.check_output function from https://gist.github.com/edufelipe/1027906 | |
def check_output(*popenargs, **kwargs): | |
r"""Run command with arguments and return its output as a byte string. | |
Backported from Python 2.7 as it's implemented as pure python on stdlib. |
NewerOlder