Skip to content

Instantly share code, notes, and snippets.

@tabrindle
tabrindle / CrippleAndroidFileTransfer.sh
Created September 24, 2015 12:07
Autostarting Android File Transfer is a pain...
ask(){
tput bel
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
default=Y
elif [ "${2:-}" = "N" ]; then
prompt="y/N"
default=N
else
@tabrindle
tabrindle / update_android_sdk.sh
Last active May 16, 2016 21:45
Update/install android sdk packges automatically
#!/bin/bash
# Notes:
# - To list all possible packages, run `android list sdk -all --extended`
# - If install operation fails, it may be because selected module is obsolete
# - Enable --dry-mode on `android update sdk` to show what will be installed while actually doing nothing
# - `tools` and `platform-tools` install the newest package available
# - Build Tools - build-tool-xx.x.x selects a specific version to install
# - SDK Platforms - android-{API_Level} installs the SDK Platform for XX API Level ex. android-23 or android-19
# - System Images - sys-img-{architecture}-{platform}-android-{API_Level} ex. sys-img-x86_64-android-23 or sys-img-armeabi-v7a-android-23
@tabrindle
tabrindle / gist:97fa578ed7fc044de596
Created February 2, 2016 16:27
cripple android file transfer
ask(){
tput bel
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
default=Y
elif [ "${2:-}" = "N" ]; then
prompt="y/N"
default=N
else
@tabrindle
tabrindle / webp-convert-directory.sh
Last active August 10, 2025 22:45
Convert all files in directory to webp, with default params, or standard cwebp params passed from command
#!/bin/bash
PARAMS=('-m 6 -q 70 -mt -af -progress')
if [ $# -ne 0 ]; then
PARAMS=$@;
fi
cd $(pwd)
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.Network-Link-Conditioner" --delay 3
end tell
---
tell application "System Events"
tell application process "System Preferences"
get checkboxes
click ((checkboxes of window "Network Link Conditioner") whose description is "enable switch")
end tell
@tabrindle
tabrindle / config.js
Created April 19, 2016 22:16
Client side config object for web apps
(function() {
const fetchJSON = function(url) {
return Q.Promise((resolve) => {
const xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
if (xhr.getResponseHeader('Content-Type') === 'application/json') {
resolve(JSON.parse(xhr.responseText));
}
@tabrindle
tabrindle / gist:9affae679e8097737bc3e82ba7db1001
Created April 26, 2016 20:33
transpile sencha with babel
#!/bin/bash
project=$(pwd)
OLD_MD5=`cat $project/sencha/.app-es6.md5`
CURRENT_MD5=`tree -Ds -P '*.js' --timefmt %T $project/sencha/app-es6 | md5`
if [ "$OLD_MD5" != "$CURRENT_MD5" ]; then
tree -Ds -P '*.js' --timefmt %T $project/sencha/app-es6 | md5 > $project/sencha/.app-es6.md5
npm run build-prod
// http://docs.sublimetext.info/en/latest/reference/build_systems/configuration.html#variants
{
"shell_cmd": "make",
"selector": ["source.js", "source.scss"],
"working_dir": "${folder}",
"variants": [{
"name": "Styles",
"shell_cmd": "make styles"
}, {
"name": "Transpile",
#!/bin/bash
expect -c "
set timeout -1;
spawn android update sdk --no-ui --all --filter tools,platform-tools,android-22,$(android list sdk -u -a -e | grep 'build-tools-' | head -n 2 | tail -n 1 | cut -d' ' -f4 | tr -d '"'),extra-android-m2repository,extra-google-m2repository,extra-google-google_play_services,extra-google-webdriver,extra-intel-Hardware_Accelerated_Execution_Manager;
expect {
\"Do you accept the license\" { exp_send \"y\r\" ; exp_continue }
eof
}
"