Skip to content

Instantly share code, notes, and snippets.

View groupsky's full-sized avatar
💭
I may be very slow to respond.

Geno Roupsky groupsky

💭
I may be very slow to respond.
  • Plovdiv/Bulgaria
View GitHub Profile
@groupsky
groupsky / ParameterizedFactory.java
Created June 25, 2011 14:15
Reflections based ParameterizedFactory
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
// from http://code.google.com/p/reflections/
import org.reflections.Reflections;
@groupsky
groupsky / git-backup-repo
Created November 23, 2011 17:06
Backup git repo to another repo
#!/bin/bash
# Pushesh all branch heads from origin remote to backup repo
# prerequisites:
# 1. git clone <from the origin>
# 2. git remote add backup <backup repo>
git branch -a | grep remotes/origin | cut '-d/' -f3 | grep -v HEAD | while read i; do git push -u backup remotes/origin/$i:refs/heads/$i; done
@groupsky
groupsky / 51-android.rules
Created September 19, 2012 06:17
linux configuration for running adb as user
# this file should be at /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="04c5", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="091e", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
@groupsky
groupsky / custom_rules.xml
Created September 26, 2012 15:57
Android build that produces output file with attached version from manifest when building on jenkins. The manifest version is updated so any -SNAPSHOT suffix is replaced by the build number and the versionCode is updated with build number
<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules">
<!-- ******************************************************* -->
<!-- ******************* Other Properties ****************** -->
<!-- ******************************************************* -->
<property environment="jenkins-env"/>
<!-- ******************************************************* -->
@groupsky
groupsky / git-sync-repo.sh
Last active October 11, 2015 14:08
Synch git repo
#!/bin/bash
set -e
set -x
git reset --hard ORIG_HEAD || echo skipping
git checkout .
rm -rf `git status -s | cut -c 4-`
git remote | grep clone || git remote add clone $1
@groupsky
groupsky / gist:4070884
Created November 14, 2012 07:53
Code to invite all friends to a page
javascript:var x=document.getElementsByTagName("input"); for(var i=0;i<x.length;i++) { if (x[i].value == 'Invite') {x[i].click();}}
@groupsky
groupsky / gist:4205164
Created December 4, 2012 15:30
Show android task groups
adb shell dumpsys activity activities
@groupsky
groupsky / gist:4239169
Created December 8, 2012 07:53
adb dumpsys
# all activity tasks
adb shell dumpsys activity activities
@groupsky
groupsky / gist:4501206
Last active December 10, 2015 22:18
deploy release apps to all connected devices
for APK in `find $WORKSPACE -type f -name '*-release*.apk'`; do
for DEVICE in `adb devices | tail -n+2 | cut -f1`; do
echo "installing $APK on $i"
adb -s $DEVICE install -rs $APK
done
done
echo "done deploying"
@groupsky
groupsky / gist:4501582
Created January 10, 2013 12:13
deploy only release apps to all connected devices
for APK in `find $WORKSPACE -type f -name '*-release*.apk'`; do
if [[ "$APK" != *unaligned* ]]; then
if [[ "$APK" != *unsigned* ]]; then
for DEVICE in `adb devices | tail -n+2 | cut -f1`; do
echo "installing $APK on $i"
adb -s $DEVICE install -rs $APK
done
fi
fi
done