Skip to content

Instantly share code, notes, and snippets.

@Androguide
Androguide / responsify.scss
Created March 19, 2014 13:39
Simple SASS mixin using the @content directive used as a short-hand for the standard bootstrap 3.x.x media-queries
@mixin responsify($target) {
@if $target == large {
@media screen and (min-width: 1200px) {
@content;
}
}
@if $target == medium {
@media screen and (min-width: 992px) and (max-width: 1200px) {
@Androguide
Androguide / mka-grep-errors.sh
Last active August 29, 2015 13:56
Easily find compilation errors when building the Android platform with several CPU thread
mka bacon -j${1} | ack-grep error | tee ~/build-errors.log
@Androguide
Androguide / git-log-alias.sh
Created February 11, 2014 15:21
Improve git log command by displaying all commits on one line, with different colors for the commit SHA, author, message & commit date. Also displays the branch visualisation. Screenshot: http://goo.gl/lb9gyx
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@Androguide
Androguide / set-opacity.scss
Created January 29, 2014 09:23
Sass mixin for prefixing the opacity propery
@mixin setOpacity($amount) {
-moz-opacity: $amount / 100;
-khtml-opacity: $amount / 100;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + $amount + ")";
filter: alpha(opacity=$amount);
opacity: $amount / 100;
}
@Androguide
Androguide / cherry-pick.sh
Last active January 4, 2016 19:09
Git cherry-pick a commit from an external online repository
git fetch https://gerrit.omnirom.org/repo_url refs/changes/XX/XXXX/X && git checkout FETCH_HEAD
@Androguide
Androguide / launch-app.sh
Created January 28, 2014 09:50
Launch an Android app through adb using the apk name instead of the package name (e.g: launch-app.sh yourapp.apk)
pkg=$(aapt dump badging $1|awk -F" " '/package/ {print $2}'|awk -F"'" '/name=/ {print $2}')
act=$(aapt dump badging $1|awk -F" " '/launchable-activity/ {print $2}'|awk -F"'" '/name=/ {print $2}')
adb shell am start -n $pkg/$act
@Androguide
Androguide / external-cherry-pick.sh
Created January 27, 2014 19:58
Git one-liner to cherry-pick a commit from another repo
git --git-dir=../other/repo/path/.git \
format-patch -k -1 --stdout <commit SHA> | \
git am -3 -k
@Androguide
Androguide / boilerplate.sh
Last active January 4, 2016 02:39
Bash boilerplate for coloured scripts and checking for passed arguments
#!/bin/bash
CYAN="\\033[1;36m"
GREEN="\\033[1;32m"
YELLOW="\\E[33;44m"
RED="\\033[1;31m"
RESET="\\e[0m"
MODE='blah'
if [ -z "$1" ]
@Androguide
Androguide / 51-android.rules
Created January 15, 2014 21:42
Linux udev rules for adb & fastboot protocols on a variety of vendors and devices (location: /etc/udev/rules.d/51-android.rules)
#Lenovo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666", OWNER="androguide"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666", OWNER="androguide"
#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666", OWNER="androguide"
#NEC
@Androguide
Androguide / cm_rhine_honami_row_defconfig
Last active January 1, 2016 09:39
msm8974 kernel defconfig for Ubuntu Touch on honami (Sony Xperia Z1)
# CONFIG_ARM_PATCH_PHYS_VIRT is not set
CONFIG_EXPERIMENTAL=y
CONFIG_LOCALVERSION="-perf"
CONFIG_KERNEL_LZO=y
CONFIG_SYSVIPC=y
CONFIG_AUDIT=y
CONFIG_RCU_FAST_NO_HZ=y
CONFIG_IKCONFIG=y
CONFIG_CGROUPS=y
CONFIG_CGROUP_DEBUG=y