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 / 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"
@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 / 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
# 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
#!/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
@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=' '

Keybase proof

I hereby claim:

  • I am xgouchet on github.
  • I am xgouchet (https://keybase.io/xgouchet) on keybase.
  • I have a public key whose fingerprint is 35B2 0154 3D41 A27E 2DBA 7C6E 7650 A508 4AB6 4CD6

To claim this, I am signing this object:

@xgouchet
xgouchet / git-imgdiff
Created April 16, 2015 07:05
A tool to show image changes in git diff
#!/bin/sh
# this uses ImageMagick, so make sure it's installed for this to work
compare $2 $1 png:- | montage -geometry +4+4 $2 - $1 png:- | display -title "$1" -
@xgouchet
xgouchet / .gitattributes
Created April 16, 2015 06:57
A Git attributes, used to specify diff commands for specific file types
*.gif diff=image
*.jpg diff=image
*.png diff=image
@xgouchet
xgouchet / sessionrc
Last active August 29, 2015 14:15
A gimp layout preference file to mimic Photoshop's layout
; This file installs layout preferences from Photoshop 6 in GIMP 2.8.
;
; Rename it to 'sessionrc' and place it into your personal GIMP directory:
; ~/.gimp-2.8 folder (Linux)
;
;
(session-info "toplevel"
(factory-entry "gimp-empty-image-window")
(position 195 356)