Skip to content

Instantly share code, notes, and snippets.

@rbochet
rbochet / ssh-copy-id
Created August 23, 2011 15:29
ssh-copy-id for the operating systems without this command (like Ubuntu). Put it in the path and use it with 'ssh-copy-id [email protected]'
cat ~/.ssh/*.pub | ssh $1 'mkdir -p .ssh; chmod 700 .ssh; cat>>.ssh/authorized_keys'
@rbochet
rbochet / UnixPipeActivity.java
Created May 18, 2011 03:45
How to write in pipes for Android
package fr.stackr.android.upt;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
@rbochet
rbochet / Main.java
Created May 11, 2011 15:42
This program runs a server that give you the IP address of every client that tries to connect. It works on both side (display the IP and send it back). It is quite useful as a whatismyip service on a local network.
package fr.stackr.java.gimmeyourip;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.WriteAbortedException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
@rbochet
rbochet / Main.java
Created May 11, 2011 15:42
This program runs a server that give you the IP address of every client that try to connect. Its quite useful as a whatismyip service on a local network.
package fr.stackr.java.gimmeyourip;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
/**
* This program runs a server that give you the IP address of every client that
* try to connect. Its quite useful as a whatismyip service on a local network.
@rbochet
rbochet / Logcat.cpp
Created May 8, 2011 06:57
Option cachée dans Logcat
case 'Q':
/* this is a *hidden* option used to start a version of logcat */
/* in an emulated device only. it basically looks for androidboot.logcat= */
/* on the kernel command line. If something is found, it extracts a log filter */
/* and uses it to run the program. If nothing is found, the program should */
/* quit immediately */
#define KERNEL_OPTION "androidboot.logcat="
#define CONSOLE_OPTION "androidboot.console="
{
int fd;
@rbochet
rbochet / GoogleChartLoad.sh
Created April 3, 2011 14:06
Should work on every unix, including OSX (doesn't rely on procfs)
max="3";load=$(uptime | cut -d":" -f4 | cut -d" " -f2 | sed s/,/./g);echo "http://chart.apis.google.com/chart?chxr=0,0,"$max"&chxt=y&chs=700x240&cht=gm&chds=0,"$max"&chd=t:"$load"&chl="$load"&chtt=$(hostname | sed s/.local//)+load+average"
@rbochet
rbochet / MapsApiv3.html
Created March 27, 2011 05:17
Google Maps API v3: LatLngBounds and multiple infoWindows
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<title>API Maps v3: Multiple infoWindows and zoom issues</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var sites = [
['Darlington', -35.0252820, 138.5630230, 1, 'Darlington, where I am living.<br/><a href="http://www.flickr.com/photos/rbochet/5560158585/" title="Figue agressive de Romain Bochet, sur Flickr"><img src="http://farm6.static.flickr.com/5030/5560158585_c9a6919140_m.jpg" width="240" height="160" alt="Figue agressive" /></a><br/>See my <a href="http://www.flickr.com/photos/rbochet/sets/72157625988396879/">Flickr album</a>'],
@rbochet
rbochet / RunAsRoot.java
Created March 18, 2011 15:59
How to ask for root privileges.
Process root = Runtime.getRuntime().exec("su");
@rbochet
rbochet / .gitignore
Created March 16, 2011 03:48 — forked from kogakure/.gitignore
.gitignore file for LaTeX projects on Mac
# Latex files
*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
@rbochet
rbochet / strings.xml
Created March 9, 2011 06:32
Wikitionnary base
<string name="template_user_agent">"%s/%s (Linux; Android)"</string>
<string name="template_wotd_title">"Wiktionary:Word of the day/%s %s"</string>
<string name="template_define_url">"http://en.wiktionary.org/wiki/%s"</string>