Skip to content

Instantly share code, notes, and snippets.

View emjayoh's full-sized avatar

Matt Ogram emjayoh

View GitHub Profile
@emjayoh
emjayoh / wget_opendir.sh
Created February 28, 2021 21:31
[wget] open dir no parent or index file #wget #opendir #recursive #free #download
wget -r -np -R "index.html*" <url>
@emjayoh
emjayoh / get_subtitles.sh
Created February 27, 2021 12:50
[DL youtube] various snippets for downloading youtube videos and subtitles
youtube-dl --write-auto-sub --sub-lang en --skip-download <URL>
@emjayoh
emjayoh / install-openssl.sh
Last active February 24, 2021 06:54
[Flags pyenv install] fix errors using python/brew #python #libary #bug #cflags #flags
brew uninstall --ignore-dependencies openssl && brew install openssl && CFLAGS="-I$(brew --prefix openssl)/include" LDFLAGS="-L$(brew --prefix openssl)/lib" pyenv install 2.7.0
@emjayoh
emjayoh / rgdefault.sh
Created February 22, 2021 16:26
[ripgrep defaults] sensible default go into ~/.zshrc.d/<file> #ripgrep #grep #find #search #terminal #bash #zsh #productivity #workflow
export FZF_DEFAULT_COMMAND='rg --files --no-ignore-vcs --hidden'
@emjayoh
emjayoh / print-files-conditional-function.sh
Created February 4, 2021 06:09
[Search/print bash] Print all directories where files satisfy condition
set -o extendedglob
has_useful_entries()
()(($#)) ${1-$REPLY}/^(#i)(*.tmp|desktop.ini|Thumbs.db|.picasa.ini)(NDoN[1])
printf '%s\n' **/*(D/F^+has_useful_entries)
@emjayoh
emjayoh / tree-print-to-file.sh
Last active February 3, 2021 04:11
[Dir tree print] to html file #bash #dir #tree #print #output #file
tree -d -R --prune --du -o "<filename>"
@emjayoh
emjayoh / iphone-text-message-sqlite.sql
Created January 27, 2021 20:09 — forked from aaronhoffman/iphone-text-message-sqlite.sql
SQLite SQL Query for iPhone Text Message Backup
-- more info http://aaron-hoffman.blogspot.com/2017/02/iphone-text-message-sqlite-sql-query.html
select
m.rowid
,coalesce(m.cache_roomnames, h.id) ThreadId
,m.is_from_me IsFromMe
,case when m.is_from_me = 1 then m.account
else h.id end as FromPhoneNumber
,case when m.is_from_me = 0 then m.account
else coalesce(h2.id, h.id) end as ToPhoneNumber
,m.service Service
@emjayoh
emjayoh / crop-and-resize.py
Created January 23, 2021 01:01
[Batch process images] resize/crop #python #graphics #batch #resize #crop
#Python 2.7, PIL 1.1.7
import Image
import glob
import os
#Function to resize image, preserving aspect ratio
def resizeAspect(im, size):
w,h = im.size
aspect=min(size[0]/float(w), size[1]/float(h))
#!/usr/bin/env python3
'''
A script to recursively compare two directories (including file size and file hash changes)
Usage: python3 compare_dirs.py DIR1 DIR2
'''
import os, sys, hashlib
COMPARE_FILES = True # should file sizes be compared if their names are the same?
@emjayoh
emjayoh / regex.md
Created January 13, 2021 08:43
[BitWarden regex reference] Fix pesky matching errors in bitwarden #passwords #password-manager #regex

Regexes for URL matching of common sites (useful for pw managers and such)

  • Google: ^https://.*google.com$