Skip to content

Instantly share code, notes, and snippets.

View samueltardieu's full-sized avatar

Samuel Tardieu samueltardieu

View GitHub Profile
translations missing or not in the right place for language 'de':
Only in values/strings.xml:
<string name="caches_map_locus_export">Export to Locus</string>
<string name="about_version">Version</string>
<string name="map_source_osm_mapnik">OSM: Mapnik</string>
<string name="map_source_osm_offline">OSM: Offline</string>
<string name="cache_menu_streetview">Street View</string>
<string name="cache_menu_oruxmaps">OruxMaps</string>
<string name="gpx_import_title_static_maps">Store static maps</string>
<string name="gpx_import_title_reading_file">Reading file</string>
@samueltardieu
samueltardieu / gist:3849364
Created October 7, 2012 19:48
Ledger example file
2012-10-01 Buy bitcoins
Assets:Bitcoins 2 BTC @ $11
Assets:USD
2012-10-02 Sell bitcoins
Assets:USD
Assets:Bitcoins -1 BTC (@) $10
@samueltardieu
samueltardieu / dnstop.txt
Created November 5, 2012 18:13
Main hosts querying will-spam-for-food.eu.org name server
Destinations Count % cum%
---------------- --------- ------ ------
88.190.27.159 11259 90.7 90.7
2a01:e0b:2135::1 1154 9.3 100.0
Query Type Count % cum%
---------- --------- ------ ------
A? 12401 99.9 99.9
AAAA? 4 0.0 99.9
TXT? 4 0.0 100.0
@samueltardieu
samueltardieu / gist:4071763
Created November 14, 2012 12:05
Missing c:geo Portuguese translations
translations missing or not in the right place for language 'pt':
Only in values/strings.xml:
<string name="log_today">Today</string>
<string name="log_yesterday">Yesterday</string>
<string name="log_smilies">Smilies</string>
<string name="translate_to_sys_lang">Translate to %s</string>
<string name="translate_to_english">Translate to English</string>
<string name="translate_length_warning">Translate may fail with large amounts of text.</string>
<string name="err_detail_google_maps_limit_reached">c:geo failed to download static maps. Maybe google maps limit is reached.</string>
<string name="warn_invalid_mapfile">The selected map file is not a valid mapsforge version 0.3.0 map file.\nOffline maps are not available.</string>
@samueltardieu
samueltardieu / gist:4120844
Created November 20, 2012 20:28
lsusb -v
Bus 002 Device 073: ID 08e6:5501 Gemplus GemProx-PU Contactless Smart Card Reader
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
// Use with a default value as in:
// runningScalaVersion getOrElse "2.8.0"
lazy val runningScalaVersion = {
val matcher = """version (\d+\.\d+\.\d+).*""".r
util.Properties.versionString match {
case matcher(vsn) => Some(vsn)
case _ => None
}
}
@samueltardieu
samueltardieu / gist:4512923
Created January 11, 2013 18:38
scala> ((x: Int, y: Int) => x+y).getClass.getMethods.find(_.getName == "apply").get.getParameterTypes.size res49: Int = 2
scala> ((x: Int, y: Int) => x+y).getClass.getMethods.find(_.getName == "apply").get.getParameterTypes.size
res0: Int = 2
// Le getMethods.find(_.getName == "apply") est dû au fait qu'il y a deux apply possible,
// un avec des "int", et un avec des "Object" (à cause de la possibilité de passer des
// "Integer") -- vive l'interaction avec la JVM. Mais ces deux apply auront obligatoirement
// la même arité.
@samueltardieu
samueltardieu / challenge.c
Created March 11, 2013 12:58
Le communication challenge fait en cours ce matin. Et il fonctionne :)
#include "ch.h"
#include "hal.h"
#include "lcd.h"
#define SCORED_QUIZZ 1
#define TEST_QUIZZ 2
// Define this as TEST_QUIZZ or SCORED_QUIZZ
#define QUIZZ TEST_QUIZZ
shortenUrl :: String -> String
shortenUrl url = case splitFileName url of
(dir, "index.html") | isLocal dir -> dir
_ -> url
where isLocal uri = isPrefixOf rootUrl uri || not (isInfixOf "://" uri)
@samueltardieu
samueltardieu / LockMap.java
Last active December 16, 2015 09:49
Add comments, and create already locked semaphores in order to reduce further contention opportunities.
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Semaphore;
public class LockMap<Key> {
private final ConcurrentHashMap<Key, Semaphore> map = new ConcurrentHashMap<Key, Semaphore>();
public void lock(final Key key) throws InterruptedException {
Semaphore sem = map.get(key);
while (true) {