Skip to content

Instantly share code, notes, and snippets.

View julenka's full-sized avatar

Julia Schwarz julenka

View GitHub Profile
@julenka
julenka / send_intent.sh
Created May 23, 2014 17:50 — forked from ytkhs/send_intent.sh
send intent script in shell
$ adb shell
#sample
am start -a android.intent.action.CALL -d tel://000-0000
am start -a android.intent.action.SEND -d "some message" -t text/plain
am start -a android.intent.action.VIEW -d geo:0,0?q=Tokyo
am start -n com.android.browser/.BrowserActivity
@julenka
julenka / SerializeDeserialize.java
Last active August 29, 2015 14:01 — forked from aprock/gist:2037883
Serialize and Deserialize Bundles
private String serializeBundle(final Bundle bundle) {
String base64 = null;
final Parcel parcel = Parcel.obtain();
try {
parcel.writeBundle(bundle);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final GZIPOutputStream zos = new GZIPOutputStream(new BufferedOutputStream(bos));
zos.write(parcel.marshall());
zos.close();
base64 = Base64.encodeToString(bos.toByteArray(), 0);
@julenka
julenka / deep_clone.js
Created June 5, 2014 16:13
Performs deep clone on javascript object. Courtesy of @nneonneo
function deepClone(o) {
var origObjs = {};
var objCache = {};
var nextObjId = 0;
var propName = "__clone_prop_" + Math.random();
recurseClone = function(o) {
// base case
switch(typeof(o)) {
case 'undefined':
@julenka
julenka / monitor_dir.sh
Last active August 29, 2015 14:02
monitor directory #bash
to_monitor=/sdcard/fsrec
while [[ true ]]
do
cur_contents=`ls ${to_monitor}`
if [[ $cur_contents != $prev_contents ]] ; then
echo '++++++'
echo "$cur_contents"
echo '++++++'
fi
prev_contents=$cur_contents
@julenka
julenka / androidGetLocationOnScreen.java
Last active August 29, 2015 14:03
get view location #android
/* Functions to set up the view's size and position */
private int[] getViewPos() {
int[] loc = {0, 0};
this.getLocationOnScreen(loc);
return loc;
}
@julenka
julenka / androidInitMenu.java
Last active August 29, 2015 14:03
Initialize Menu #android
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.start, menu);
return true;
}
@julenka
julenka / gist:3ef9fbfe02abab498e23
Last active August 29, 2015 14:04
convert all pngs to jpgs in dir #bash
for im in *.png; do
im_jpg=${im/.png/.jpg}
convert $im $im_jpg
done
@julenka
julenka / adbWifi.sh
Last active August 29, 2015 14:05
Convert all adb USB connections to WiFi #android
#!/bin/bash
#Modify this with your IP range
MY_IP_RANGE="192\.168\.1"
#You usually wouldn't have to modify this
PORT_BASE=5555
#List the devices on the screen for your viewing pleasure
adb devices
@julenka
julenka / goHome.java
Last active August 29, 2015 14:05
go home #android
private void goHome() {
Intent home = new Intent(Intent.ACTION_MAIN);
home.addCategory(Intent.CATEGORY_HOME);
home.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(home);
}
@julenka
julenka / Readme.md
Last active August 29, 2015 14:06
Commented version of jinroh's fourier series visualization in d3 #js

jinroh's Fourier series visualization in js is really excellent, but I had a hard time understanding the code. This is my attempt at commenting the jinroh's code for my own understanding, and hopefully for the benefit of others.