Skip to content

Instantly share code, notes, and snippets.

View Kangaroux's full-sized avatar
🌈
feeling colorful

Jessie Kangaroux

🌈
feeling colorful
  • US
View GitHub Profile
@Kangaroux
Kangaroux / idleFingers.tmTheme
Last active January 23, 2018 02:16
Sublime theme (modified idleFingers)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>idleFingers</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@Kangaroux
Kangaroux / .bash_aliases
Last active February 28, 2018 04:58
Tons of shortcuts for git commands, python
#!/bin/bash
# NOTE: If you use a git remote that's named something other than "origin",
# you will need to edit the $GIT_REMOTE var below:
GIT_REMOTE="origin"
git_add() {
if [ $# = 0 ]; then
git add -A
@Kangaroux
Kangaroux / .profile
Created February 28, 2018 01:45
Some quality of life improvements for bash (fix git asking for SSH key password, shorten bash prompt, etc)
# Set the prompt text (<prompt>$ )
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# <user>:<cwd>$
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u:\[\033[01;34m\]\w\[\033[00m\]\$ '
# Start the ssh-agent if it's not running so you don't need to keep
# typing your password for things like git
adclick.g.doublecklick.net
adeventtracker.spotify.com
ads-fa.spotify.com
analytics.spotify.com
audio2.spotify.com
# Declare `foo` to be a string variable.
foo = "bar" # type: str
# Type error!
foo = True
# Old type comments:
foo = "bar" # type: str
# New type hints for Python 3.5+:
foo: str = "bar"
pip install mypy
# Check a single file
mypy script.py
# Check a folder
mypy src/
# Check a package
mypy -p my_package
# Declare a variable and use it later.
foo: int
# ...
foo = 5
# Add type hints for function arguments and return types.
def say_hello(name: str) -> str:
return f"Hello {name}!"
@Kangaroux
Kangaroux / gist:46bb853f13a637c071b1f890e1217724
Created July 16, 2020 01:24
Disable automatic audio device switching for linux, ubuntu (USB, controller, dualshock)
# If you want to stop your system from automatically switching audio devices,
# there is a simple edit to your PulseAudio config to disable that feature.
# Open PulseAudio config
sudo vim /etc/pulse/default.pa
# Comment out the line with "load-module module-switch-on-connect"
# Restart PulseAudio
pulseaudio -k
@Kangaroux
Kangaroux / .go
Created May 20, 2021 02:40
Golang: Parse JSON field name from a struct field
// ParseFieldName takes a reflected struct field and returns the JSON name for the field,
// as well if the field is ignored by JSON (using `json:"-"`).
func ParseFieldName(f reflect.StructField) (name string, ignore bool) {
tag := f.Tag.Get("json")
if tag == "" {
return f.Name, false
}
if tag == "-" {