Skip to content

Instantly share code, notes, and snippets.


James Pearson Hughes xiongchiamiov

View GitHub Profile
function wchs {
for i in "$@"; do
count=$(find "$i" | wc -l)
echo "$count\t$i"
function wchs-sort {
wchs "$@" | sort -nr
xiongchiamiov /
Last active Apr 15, 2021
Use this when Amazon gives you an "Encoded authorization failure message" and you need to turn it into something readable. If you only get a request id... you're out of luck.
function decode-authorization-failure-message {
if [ $# -ne 1 ] || [ "$1" = -h ] || [ "$1" = --help ]; then
cat <<'EOT'
Usage: decode-authorization-failure-message <message>
Use this when Amazon gives you an "Encoded authorization failure message" and
you need to turn it into something readable.
return 1
View gist:34a1e38423242e0e92bdccc1bd0238db
┌─[jamesph@ilmr] - [~/temp] - [Wed Apr 06, 11:12]
function install {
set -x
dnf install $1 | tee -a ~/Scripts/dnf_install.log
set +x
┌─[jamesph@ilmr] - [~/temp] - [Wed Apr 06, 11:12]
┌─[jamesph@ilmr] - [~/temp] - [Wed Apr 06, 11:12]
View gist:35b01285910d8f6e4e43b64bfe8522be
[$]> ansible all -i hosts.ini --ask-sudo-pass -m apt -a 'update_cache=yes upgrade=safe' --become
View gist:04d0e1600b040f1a0d97
┌─[jamesph@ilmr] - [~/temp/rm_if_link] - [Wed Mar 23, 01:14]
└─[$]> ll
total 0
┌─[jamesph@ilmr] - [~/temp/rm_if_link] - [Wed Mar 23, 01:14]
└─[$]> touch foo
┌─[jamesph@ilmr] - [~/temp/rm_if_link] - [Wed Mar 23, 01:14]
└─[$]> ln -s foo bar
┌─[jamesph@ilmr] - [~/temp/rm_if_link] - [Wed Mar 23, 01:14]
└─[$]> ll
total 0
xiongchiamiov /
Last active Mar 3, 2016
Dealing with docker's disk space issues

See how much space is available

[$]> docker info 2>/dev/null | grep 'Data Space'     
 Data Space Used: 107.4 GB                             
 Data Space Total: 107.4 GB                            
 Data Space Available: 20.05 MB                        

Delete old containers

[$]> docker ps -aq | xargs docker rm

Improving Security for Bugzilla

Frequently asked questions

What happened?

Bugzilla restricts access to security-sensitive information so that only certain privileged users can access it. An attacker was able to break into a privileged user’s account and download security-sensitive information about flaws in Firefox and other Mozilla products.

How did the attacker gain access?

View gist:7ae0d68a82a159f23e70
Process: clementine [19189]
Path: /Applications/
Identifier: org.clementine-player.clementine
Version: 1.2.3-1280-g10860b7 (4096.
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: clementine [19189]
User ID: 501
Date/Time: 2015-08-04 13:24:02.003 -0700
#!/usr/bin/env python
import requests
from constants import *
auth = requests.auth.HTTPBasicAuth(client_id, client_secret)
data = {
'grant_type': 'password',
'username': username,
xiongchiamiov / gist:d3dc7b59ddee5bbd3024
Last active Apr 8, 2016
Things that annoy me about android apps for reddit
View gist:d3dc7b59ddee5bbd3024

reddit is fun

  • UI is so cluttered and ungainly and requires so many clicks to do things I couldn't stand using it long enough to build a more complete list

relay for reddit

  • clicking through messages doesn't sync read state back to the website
  • after hiding a submission, opening the submission before it opens the original one
  • no way to view the comments on a submission that links to another post on reddit
  • have to scroll back up above all comments to add one yourself
  • voting on, replying to, etc. long comments requires scrolling back to the middle of the comment
  • no support for wiki pages