Skip to content

Instantly share code, notes, and snippets.

Matt Crook crookm

Block or report user

Report or block crookm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@crookm
crookm / ffmpeg.sh
Created Nov 4, 2018
FFmpeg commands to create DASH and HLS
View ffmpeg.sh
mkdir dash && \
ffmpeg -hide_banner -i original.mkv -c:v libvpx-vp9 -row-mt 1 -keyint_min 150 -g 150 -tile-columns 4 -frame-parallel 1 \
-movflags faststart -f webm -dash 1 -speed 3 -threads 4 -an -vf scale=426:240 -b:v 400k -r 30 -dash 1 dash/426x240-30-400k.webm && \
ffmpeg -hide_banner -i original.mkv -c:v libvpx-vp9 -row-mt 1 -keyint_min 150 -g 150 -tile-columns 4 -frame-parallel 1 \
-movflags faststart -f webm -dash 1 -speed 3 -threads 4 -an -vf scale=426:240 -b:v 600k -r 30 -dash 1 dash/426x240-30-600k.webm && \
ffmpeg -hide_banner -i original.mkv -c:v libvpx-vp9 -row-mt 1 -keyint_min 150 -g 150 -tile-columns 4 -frame-parallel 1 \
-movflags faststart -f webm -dash 1 -speed 3 -threads 4 -an -vf scale=640:360 -b:v 700k -r 30 -dash 1 dash/640x360-30-700k.webm && \
ffmpeg -hide_banner -i original.mkv -c:v libvpx-vp9 -row-mt 1 -keyint_min 150 -g 150 -tile-columns 4 -frame-parallel 1 \
-movflags faststart -f webm -dash 1 -speed 3 -threads 4 -an -vf scale=640:360 -b:v 900k -r 30 -dash 1 dash/640x360-30-900k.we
View debounce_api.js
export default class API {
constructor() {
/**
* This is the function that should be called in the
* actual application.
*/
this.apiFunc = this._debounce(this._apiFunc, 1000 * 2);
}
/**
View keybase.md

Keybase proof

I hereby claim:

  • I am crookm on github.
  • I am crookm (https://keybase.io/crookm) on keybase.
  • I have a public key ASDb2xTjW6QH6qhbUN94hemJ1SK8Ye9zadv2gmyUbNmCXgo

To claim this, I am signing this object:

@crookm
crookm / http_auth_digest_dict_attack.py
Created May 20, 2018
Basic MD5 dictionary attack on digest HTTP authentication methods - variables should be filled-in with captured packets
View http_auth_digest_dict_attack.py
import hashlib
extracted = 'known_auth_hash'
nonce = 'known_nonce_hash'
user = 'known_username'
realm = 'known_realm'
uri = '/image.png'
method = 'GET'
@crookm
crookm / stego_extract_img_lsb.py
Last active May 21, 2018
Python program to extract the text stored in a stego image, that uses LSB row-major - requires PIL
View stego_extract_img_lsb.py
from PIL import Image
stream = []
with open('image.png', 'rb') as img_file:
im = Image.open(img_file)
px = im.load()
x = 0
y = 0
end = False
@crookm
crookm / clean_tv_series_filenames.py
Last active Jan 10, 2019
Quick python 3 program to rename files for downloaded TV series
View clean_tv_series_filenames.py
import glob, os, re
os.chdir('/directory/you/want/to/work/in')
for file in glob.glob('*[sS][0-9][0-9][eE][0-9][0-9]*'):
ep_string = re.search('[sS][0-9]{2}[eE][0-9]{2}', file).group(0).upper()
file_type = file.split('.')[-1]
new_name = ep_string + '.' + file_type
print(new_name)
os.rename(file, new_name)
@crookm
crookm / work_dist_query.sql
Created Feb 7, 2018
Atomic selection of work that prevents race conditions
View work_dist_query.sql
UPDATE work
SET
`worker_id` = ?,
`worker_claimedAt` = NOW()
WHERE
(`worker_id` IS NULL
OR `worker_claimedAt` < DATE_SUB(NOW(), INTERVAL 30 SECOND))
AND `active` = 1
ORDER BY `worker_lastWork` DESC
LIMIT 1;
@crookm
crookm / work_dist_worker.js
Created Feb 7, 2018
Forked worker to continuously process information in node.js
View work_dist_worker.js
const self = { id: 0 };
let work_loop = () => {
// some work here! :D
};
function sendPayload(payload) {
process.send(payload);
}
@crookm
crookm / work_dist_index.js
Created Feb 7, 2018
Setup several forked processes in node.js
View work_dist_index.js
const { fork } = require('child_process');
let awaiting = {}; // array of payload ids awaiting responses from workers
let awaiting_lastid = 1; // incrementing payload ids
let worker_pool = [];
function sendPayload(id, payload) {
payload.id = awaiting_lastid++; // set and add id
awaiting[payload.id] = { worker: id, date: Date.now() }
@crookm
crookm / nginx_config_nodejs.txt
Created Feb 7, 2018
NGINX config file for node.js applications with websocket support and ssl
View nginx_config_nodejs.txt
server {
listen 80;
server_name example.com www.example.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
You can’t perform that action at this time.