Skip to content

Instantly share code, notes, and snippets.

@emil10001
emil10001 / password_generator.sh
Created September 13, 2015 06:46
Simple bash function for generating a random password
#!/bin/bash
function pw () {
cat /dev/urandom | env LC_CTYPE=C tr -dc a-zA-Z0-9 | head -c $1; echo;
}
package com.feigdev.demo.app;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
import android.widget.RemoteViews;
@emil10001
emil10001 / Reporter.java
Created May 19, 2014 15:12
Witness library for Java.
package com.feigdev.witness;
/**
* Created by ejf3 on 5/10/14.
*/
public interface Reporter {
public void notifyEvent(Object o);
}
@emil10001
emil10001 / DefaultActivity_AndroidManifest.xml
Created April 28, 2014 00:27
IntelliJ requires that an activity be specified as the default launch activity in AndroidManifest.xml
<activity
android:name="com.google.android.glass.sample.timer.MenuActivity"
android:label="@string/app_name"
android:theme="@style/MenuTheme"
android:enabled="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
package com.feigdev.hearingaid.app;
import android.app.Activity;
import android.media.*;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
public class HearingAidActivity extends Activity {
@emil10001
emil10001 / AndroidManifest_1.xml
Last active August 29, 2015 13:57
These are notes for a presentation on building a GifCamera Glassware - http://goo.gl/vZrxSQ
<activity
android:name=".GGMainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
@emil10001
emil10001 / ratchet_gradient_background.html
Created March 6, 2014 17:44
Found this awesome CSS gradient background from the Ratchet project: http://goratchet.com
<!DOCTYPE html>
<html>
<body style="background-image:linear-gradient(45deg,#0a1855 0,#da0024 100%);">
</body>
</html>
@emil10001
emil10001 / ApplicationInfoComparer.java
Last active August 29, 2015 13:56
Compare Android ApplicationInfo so that collections of them can be sorted
public static class ApplicationInfoComparer implements Comparator<ApplicationInfo> {
private PackageManager pm1;
ApplicationInfoComparer(PackageManager pm) {
pm1 = pm;
}
@Override
public int compare(ApplicationInfo x, ApplicationInfo y) {
if (null == pm1)
@emil10001
emil10001 / MirrorMenuBuilder.java
Last active August 29, 2015 13:56
A Java builder version of Google Glass Mirror API Menus
import com.google.api.services.mirror.model.MenuItem;
import java.util.ArrayList;
import java.util.List;
/**
* Created by ejf3 on 2/2/14.
*
* For reference, see docs here:
* https://developers.google.com/glass/v1/reference/timeline#menuItems
@emil10001
emil10001 / android_build.gradle
Created January 26, 2014 17:07
Specify a particular keystore when using gradle and Intellij. Very useful when you're working with APIs relying on a particular keystore.
android {
...
signingConfigs {
debug {
storeFile file("debug.keystore")
}
}
}