Skip to content

Instantly share code, notes, and snippets.

@TomTasche
TomTasche / bloki_styles.html
Created August 19, 2011 12:25
Available Bloki styles
<!-- See them all at http://bloki-engine.appspot.com/gallery/designs.html -->
<link href="http://bloki-engine.appspot.com/style/button/plain.css"
rel="stylesheet" type="text/css" />
<link href="http://bloki-engine.appspot.com/style/getsatisfaction/horizontal_black.css"
rel="stylesheet" type="text/css" />
<link href="http://bloki-engine.appspot.com/style/getsatisfaction/horizontal_blue.css"
rel="stylesheet" type="text/css" />
@TomTasche
TomTasche / SuperfeedrServlet.java
Created September 12, 2011 20:57
SuperfeedrServlet for accessing private (aka authenticated) feeds
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
@TomTasche
TomTasche / ifconfigme.java
Created September 15, 2011 20:40
Quick n dirty ifconfig.me call in Java
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://ifconfig.me/ip");
HttpResponse httpResponse = httpClient.execute(httpGet);
System.out.println(new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent())).readLine());
@TomTasche
TomTasche / cisco_ap_show_rogue.txt
Created November 29, 2011 15:45
List rogue networks of a Cisco Access Point and inspect them in detail.
!taken from http://www.cisco.com/en/US/products/ps6366/products_tech_note09186a0080b40901.shtml
(Cisco Controller) >show rogue ap summary
Rogue on wire Auto-Contain....................... Disabled
Rogue using our SSID Auto-Contain................ Disabled
Valid client on rogue AP Auto-Contain............ Disabled
Rogue AP timeout................................. 1200
@TomTasche
TomTasche / InfiniteWakelockIntentService.java
Created April 24, 2012 08:21
Mix of IntentService and WakefulIntentService
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.MessageQueue.IdleHandler;
import android.os.PowerManager;
@TomTasche
TomTasche / TextToSpeechService.java
Created April 24, 2012 08:23
Sample implementation for InfiniteWakefulIntentService
import android.content.Intent;
import com.announcify.uberall.droid.util.TextToSpeechHelper;
public class TextToSpeechService extends InfiniteWakelockIntentService {
private TextToSpeechHelper helper;
public TextToSpeechService() {
super("Announcify - Text-To-Speech");
@TomTasche
TomTasche / whitespace_trimmer
Created January 27, 2013 18:06
Trim surrounding whitespace from pictures
#!/bin/bash
if [ -z "$1" ]
then
exit 1
fi
cd "$1"
cropImage() {
@TomTasche
TomTasche / git_status_all_the_things.bash
Last active December 16, 2015 09:39
"git status" for all folders in the current directory
#!/bin/bash
for dir in */;
do
clear;
echo $dir;
cd $dir;
git status;
cd ..;
read -p "Press [Enter] key to continue..."
@TomTasche
TomTasche / DoesStringPoolExist.java
Created May 4, 2013 19:42
i had a discussion about the possible existence of a global "String pool" in newer versions of Java. turns out, there is no such thing. however, hardcoded strings are "pooled", i.e. String a and String b in the example are the *same instance of String*.
String a = "test";
String b = "test";
System.out.println("a == b? " + (a == b)); // true
String c = "tester";
String d = a + "er";
System.out.println("c == d? " + (c == d)); // false
@TomTasche
TomTasche / EinStern.java
Last active December 17, 2015 02:19
EinStern is a mixture of routing algorithms like depth-first and dijkstra. it is able to find a path between "things" - points without any distance or similar between each other. Blog post about it: http://blog.tomtasche.at/2013/05/routing-things-and-stuff.html
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* some kind of depth-first and dijkstra mixture. this little code snippet is
* able to find a path between "things" - points without any distance or similar
* between each other
*