Skip to content

Instantly share code, notes, and snippets.

View j0yu's full-sized avatar
👌

Joe Yu j0yu

👌
View GitHub Profile
@j0yu
j0yu / .bashrc
Last active September 9, 2017 19:14
INSTALL: Add me to .bashrc, OR if you do not have .bashrc, save me as .bashrc in home directory
Q() {
######################################################################################
## To use after "install", literally type in Q in terminal and press enter ##
## IF ERROR (Normally first install): Open a new Terminal window THEN type Q ##
######################################################################################
clear
TOTAL=$(quota -s | tail -1 | cut -d " " -f 20 | grep -o "[0-9]*")
USED=$(quota -s | tail -1 | cut -d " " -f 18 | grep -o "[0-9]*")
PERCENT=$(bc <<< "scale=2; $USED*100/$TOTAL" )
TOTAL=$(bc <<< "scale=3; $TOTAL / 1024")
class sweet:
sweetness=0
def __init__(self, inputSweetness):
print "I'm aliveeee"
self.sweetness = inputSweetness
def addSweetness(self, inputSweetness):
self.sweetness = self.sweetness + inputSweetness
import maya.cmds as mc
print '\n'*8
print '-'*80
print "Deleting un-used anim curve nodes (they don't output to anything)"
print '-'*80
for curveType in ["animCurveTL", "animCurveTA", "animCurveTU", "animCurveTT" ]:
for curveNode in mc.ls(type=curveType):
if mc.listConnections(curveNode+'.output') is None:
@j0yu
j0yu / maya-border
Last active November 22, 2019 16:35
(In Maya) Output a dialog with all the available standard Qt Icons
w = QtGui.QDialog()
l = QtGui.QGridLayout(w)
row = 0
column = 0
for i in [
"closed", "end", "more", "open", "root-closed", "root-open", "single", "vline",
]:
p = QtGui.QPushButton(i)
s = p.style()
p.setIcon(QtGui.QIcon(":/branch-{}.svg".format(i)))
for unknPlugin in (mc.unknownPlugin(query=True, list=True) or []):
try:
mc.unknownPlugin(unknPlugin, remove=True)
print('Unknown plugin removed : {}'.format(unknPlugin))
except RuntimeError as err:
print('({}) {} (Node types: {})'
''.format(unknPlugin, err,
mc.unknownPlugin(unknPlugin, q=True,
nodeTypes=True)))
@j0yu
j0yu / colorping
Created March 17, 2018 12:09
Check your internet connection
#!/bin/bash
ping www.google.com | while read LINE;
do
MS_STR=$(echo $LINE | grep -oP '[0-9\.]+(?= ms)')
MS_INT=$(printf '%.0f' "$MS_STR")
PRE_STR='\e[0;43m\e[30m'
[ $MS_INT -gt 100 ] && PRE_STR='\e[0;41m\e[30m'
[ $MS_INT -lt 30 ] && PRE_STR='\e[0;42m\e[30m'
@j0yu
j0yu / docker_descendants.py
Last active May 7, 2019 15:36 — forked from altaurog/docker_descendants.py
Python 2 version of the Python3 script to find descendants of one or more docker images. Slightly different searching/print algorithm
#!/bin/python2
#
# usage: python2 docker_descendants.py <image_id> ...
import sys
from subprocess import check_output
from collections import defaultdict
def run(cmd):
@j0yu
j0yu / centOS7_virtual_terminal.bash
Last active August 2, 2019 11:04
scancodes for Microsoft_Natural®_Ergonomic_Keyboard_4000 special buttons
# Ctrl+Alt+2 to log into virtual terminal
# Then run the below:
showkey -k > /tmp/keycodes.txt
showkey -s > /tmp/scancodes.txt
@j0yu
j0yu / acb-patch.md
Last active March 28, 2020 22:58
Patch Steam Assassins Creed Brotherhood (flatpak)
#!/bin/bash
set -eufx -o pipefail
cd ~/.var/app/com.valvesoftware.Steam/.local/share/Steam
export WINEPREFIX=$(find steamapps/compatdata/ -mindepth 1 -maxdepth 1 -type d -print -quit)/pfx
# WINE_BIN="$(find steamapps -name wine ! -type d | sed 's/ /\\ /g')"
WINE_BIN="$(find steamapps -executable -name wine ! -type d)"
@j0yu
j0yu / bleeding-rez-hack.bash
Last active November 6, 2019 22:42
Run interactively in docker run --rm -it centos:7
########### ---- Results from running ----
########### curl -sSL https://bootstrap.pypa.io/get-pip.py | python -
########### pip install bleeding-rez
########### rez bind python
########### rez bind rez
########### cd $(mktemp -d)
########### curl -sSL https://github.com/mottosso/rez-pipz/archive/1.1.0.tar.gz | tar -xz --strip-components=1
########### rez build --install
########### rez env pipz -- chmod +x '$REZ_PIPZ_ROOT/bin/install'
########### rez env pipz -- PATH=$(dirname $(command -v python)) '$REZ_PIPZ_ROOT/bin/install' -y pip