Skip to content

Instantly share code, notes, and snippets.

View xgouchet's full-sized avatar
📖
Writing some sci-fi novel…

Xavier F. Gouchet xgouchet

📖
Writing some sci-fi novel…
View GitHub Profile
@xgouchet
xgouchet / .bashrc
Last active June 1, 2017 14:03
Custom commands and macros to include in a debian .bashrc file
# Configure Git PS1
GIT_PS1_DESCRIBE_STYLE='describe'
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWCOLORHINTS=true
GIT_PS1_HIDE_IF_PWD_IGNORED=true
GIT_PS1_SHOWUPSTREAM='legacy'
#GIT_PS1_STATESEPARATOR=' '
#!/usr/bin/env bash
# pretty bash prompt
# Based on twolfson's sexy bash prompt (https://github.com/twolfson/sexy-bash-prompt)
# If we are on a colored terminal
if tput setaf 1 &> /dev/null; then
# Reset the shell from our `if` check
tput sgr0 &> /dev/null
# If you would like to customize your colors, use
# Usually I just include that in my ~/.bashrc
# Usage : adb_pull_db_pre_lollipop com.package.name file.db
function adb_pull_db_pre_lollipop () {
if [[ -z "$1" ]]; then
echo "Usage : adb_pull_db_pre_lollipop com.package.name file.db"
exit 1
fi
@xgouchet
xgouchet / adb_kill.sh
Created December 15, 2015 09:07
Force kill a debuggable application
#########################################################################
# Kill a running android process
function adb_kill {
if [[ -z $1 ]]; then
echo "Usage : adb_kill com.example.application"
else
process=`adb shell ps | grep $1`
if [[ -n $process ]]; then
@xgouchet
xgouchet / adb_toggle_airplane_mode.sh
Created March 11, 2016 14:28
Shell script to toggle airplane mode on connected device
function adb_toggle_airplane_mode {
# Open airplane mode settings
adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS
# Key UP to focus on the first switch = toggle airplane mode, then sleep 100ms
adb shell input keyevent 19 ; sleep 0.1
# Key CENTER to toggle the first switch, then sleep 100ms
adb shell input keyevent 23 ; sleep 0.1
@xgouchet
xgouchet / export_svg.sh
Created January 7, 2019 12:31
Exports an svg image into png images for Android consumption
# usage export_svg source.svg output.png sizedp
function export_svg() {
mkdir -p "drawable-ldpi"
size=$(($3 * 3 / 4))
inkscape -z -e "drawable-ldpi/$2" -w $size -h $size "$1"
mkdir -p "drawable-mdpi"
size=$(($3))
inkscape -z -e "drawable-mdpi/$2" -w $size -h $size "$1"
mkdir -p "drawable-hdpi"