Skip to content

Instantly share code, notes, and snippets.

View xiongchiamiov's full-sized avatar

James Pearson Hughes xiongchiamiov

View GitHub Profile
@xiongchiamiov
xiongchiamiov / why.sh
Last active March 14, 2023 04:19
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.
EOT
return 1
fi
@xiongchiamiov
xiongchiamiov / gist:d3dc7b59ddee5bbd3024
Last active February 15, 2023 04:09
Things that annoy me about android apps for reddit

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
#!/usr/bin/env python3
import csv
import sys
from collections import Counter
counter = Counter()
with open(sys.argv[1]) as csvfile:
reader = csv.DictReader(csvfile)
@xiongchiamiov
xiongchiamiov / activate
Last active January 30, 2017 17:32 — forked from rahulg/activate
export GOPATH="$(builtin cd "$(dirname "${BASH_SOURCE[0]:-$_}" )" && pwd)"
export OLDPS1=$PS1
export PS1="[go:$(basename $GOPATH)] $PS1"
alias gcd="cd $GOPATH"
deactivate() {
export PS1=$OLDPS1
unset GOPATH
unset OLDPS1
unalias gcd
unset deactivate
function wchs {
for i in "$@"; do
count=$(find "$i" | wc -l)
echo "$count\t$i"
done
}
function wchs-sort {
wchs "$@" | sort -nr
}
┌─[jamesph@ilmr] - [~/temp] - [Wed Apr 06, 11:12]
└─[$]>cat function.sh
function install {
set -x
dnf install $1 | tee -a ~/Scripts/dnf_install.log
set +x
}
┌─[jamesph@ilmr] - [~/temp] - [Wed Apr 06, 11:12]
└─[$]>source function.sh
┌─[jamesph@ilmr] - [~/temp] - [Wed Apr 06, 11:12]
[$]> ansible all -i hosts.ini --ask-sudo-pass -m apt -a 'update_cache=yes upgrade=safe' --become
┌─[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
xiongchiamiov / docker.md
Last active March 3, 2016 20:57
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

@xiongchiamiov
xiongchiamiov / gist:8658366
Created January 27, 2014 22:10
clementine backtrace
[$]> gdb /Volumes/Clementine/clementine.app/Contents/MacOS/clementine
GNU gdb 6.3.50-20050815 (Apple version gdb-1824) (Wed Feb 6 22:51:23 UTC 2013)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ....
warning: Could not find object file "/src/macosx/qjson-0.7.1/build/src/CMakeFiles/qjson.dir/parser.cpp.o" - no debug information available for "parser.cpp".