Skip to content

Instantly share code, notes, and snippets.

View emjayoh's full-sized avatar

Matt Ogram emjayoh

View GitHub Profile
@emjayoh
emjayoh / jq-cheetsheet.md
Created February 21, 2022 13:43 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@emjayoh
emjayoh / 95-lolcat
Created August 31, 2021 04:20 — forked from dorentus/95-lolcat
dynamically generated /etc/motd using fortune, cowsay & lolcat,save it as /etc/update-motd.d/95-lolcat.Google `pam_motd` or `update-motd` for more details of dynamically generated message-of-the-day.
#!/bin/bash
# see: http://blog.tomtung.com/2009/11/cowsay-fortune
# http://www.commandlinefu.com/commands/view/3584/remove-color-codes-special-characters-with-sed
# https://github.com/busyloop/lolcat
# https://github.com/dorentus/mruby-lolcat-bin
#
# requires `fortune`, `cowsay`,
# and ruby gem `lolcat` or its mruby version equivalent
export LANG="en_US.UTF-8"
@emjayoh
emjayoh / .gitconfig
Last active April 17, 2021 23:18 — forked from Jiri-Mihal/.gitconfig
[global .gitconfig] Set of handy .gitconfig aliases. https://github.com/durdn/cfg/blob/master/.gitconfig. #.gitconfig
[user]
email = [email protected]
name = Firstname Lastname
[alias]
# basic
st = status -s
cl = clone
ci = commit
co = checkout
@emjayoh
emjayoh / hangouts.py
Created March 19, 2021 05:46 — forked from purneshwar/hangouts.py
Convert/Parse Google Takeout/Export Data Hangouts/Chat into individual conversations
# Run this in the same directory as the Hangouts.json file generated by Google Takeout / Data Export tool.
# python3 hangouts.py
import json
import datetime
import os
import shutil
import re
chat_dir = "hangouts"
@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
#!/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 / fif.sh
Last active November 18, 2020 15:15 — forked from gnanderson/fif.sh
[fif.sh - fuzzy + rg + bat] Find in file using ripgrep, then fuzzy find matched filenames with fzf, preview match using bat #fzf #terminal #bash #shell #bat #rg #function
fif() {
rg \
--column \
--line-number \
--no-column \
--no-heading \
--fixed-strings \
--ignore-case \
--hidden \
--follow \
@emjayoh
emjayoh / .leptonrc
Created October 17, 2020 01:59 — forked from hackjutsu/.leptonrc
[Template for .leptonrc] This is a template for Lepton's configuration file. Please place it on your home directory. #lepton
{
"theme": "light",
"autoUpdate": false,
"snippet": {
"expanded": true,
"newSnippetPrivate": false,
"sorting": "updated_at",
"sortingReverse": true
},
"editor" : {
@emjayoh
emjayoh / xrandr.sh
Last active January 13, 2021 08:53 — forked from chirag64/xrandr.sh
[Resolution adjustment xrandr] Useful for pesky resolution issues in linux #linux #graphics #xrandr #archlinux #bash
#!/bin/bash
#If no argument is specified, ask for it and exit
if [[ -z "$@" ]];
then
echo "An argument is needed to run this script";
exit
else
arg="$@"
#Basic check to make sure argument number is valid. If not, display error and exit
if [[ $(($(echo $arg | grep -o "\s" | wc --chars) / 2 )) -ne 2 ]];
@emjayoh
emjayoh / SlackPGP.js
Last active January 13, 2021 08:53 — forked from lmarkus/SlackPGP.js
[PGP over Slack using Greasemonkey] Check for update... #slack #greasemonkey #js #pgp #security
// ==UserScript==
// @name SlackPGP
// @namespace slack
// @description slackPGP
// @include https://*.slack.com/messages/*
// @version 1
// @grant none
// ==/UserScript==