Skip to content

Instantly share code, notes, and snippets.

@BryceCicada
BryceCicada / GitCodeReviews.md
Last active July 24, 2019 02:34
Git code reviews
  1. Ammend project .git/config to fetch pull/merge requests from the remote:

    1. Github:
    [remote "origin"]
    url = git@github.com:cakesolutions/arm-vaas.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
    
    1. Gitlab:
@BryceCicada
BryceCicada / make_sticky.sh
Created December 1, 2016 14:32
Make windows sticky
#!/bin/bash
MATCH=$1;
for i in $(wmctrl -l | grep ${MATCH} | awk '{print $1}'); do wmctrl -b add,sticky -i -r ${i}; done
@BryceCicada
BryceCicada / javascript_rounding.js
Created May 10, 2016 07:50
How to round correctly in javascript
function round(num, precision) {
// Avoids all the funny rounding behaviour of javascript, eg. Math.round(1.0005, 3) !== 1.001
return +(Math.round(num + 'e+' + precision) + 'e-' + precision);
}
@BryceCicada
BryceCicada / Smali toast
Created January 22, 2015 20:38
Smali conditional toast
if-eqz p2, :cond_0
invoke-super {p0}, Landroid/widget/FrameLayout;->getContext()Landroid/content/Context;
move-result-object v2
const/4 v3, 0x0
invoke-static {v2, p1, v3}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;
move-result-object v2
invoke-virtual {v2}, Landroid/widget/Toast;->show()V
:cond_0
adb shell screencap -p | sed 's/\r$//' > /cygdrive/c/Users/cnix/screen-`date +%H%M%S`.png
@BryceCicada
BryceCicada / gist:3e19d9c769e26f45d724
Created December 27, 2014 21:45
Grab android application data
adb backup -noapk <package_name> && dd if=backup.ab bs=1 skip=24 | openssl zlib -d | tar -xvf -
#!/bin/bash -e
set -o pipefail
# Any arguments are incorrect. Note that git intercepts --help and tries to
# open the man page.
#if [ $# -gt 0 ]; then
# echo 'Usage: git merge-stats'
# exit 1
#fi
#!/bin/bash
if [ -z $1 ]; then
echo "Usage: importcert.sh <CA cert PEM file>"
exit 1
fi
CACERT=$1
BCJAR=bcprov-jdk16-149.jar
@BryceCicada
BryceCicada / signit
Last active December 28, 2015 23:58
Resign an Player.apk
#!/bin/bash
ZIP_FILE=`echo $1 | sed 's/.apk/.zip/'`
KEYSTORE=~/workspace/we7-Android/Main/release.keystore
cp $1 $ZIP_FILE
zip -d $ZIP_FILE META-INF/*
mv $ZIP_FILE tmp.unsigned.apk
echo Resigning APK