Skip to content

Instantly share code, notes, and snippets.

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
/**
* @author cristian
*/
public class MultiServer {
public static void main(String[] args) throws IOException {
INSERT INTO "top_names"SELECT 1 AS '_id', 'Jacob' AS 'name', 1 AS 'rank', 1 AS 'gender' UNION SELECT 2,'Ethan',2,1 UNION SELECT 3,'Michael',3,1 UNION SELECT 4,'Jayden',4,1 UNION SELECT 5,'William',5,1 UNION SELECT 6,'Alexander',6,1 UNION SELECT 7,'Noah',7,1 UNION SELECT 8,'Daniel',8,1 UNION SELECT 9,'Aiden',9,1 UNION SELECT 10,'Anthony',10,1 UNION SELECT 11,'Joshua',11,1 UNION SELECT 12,'Mason',12,1 UNION SELECT 13,'Christopher',13,1 UNION SELECT 14,'Andrew',14,1 UNION SELECT 15,'David',15,1 UNION SELECT 16,'Matthew',16,1 UNION SELECT 17,'Logan',17,1 UNION SELECT 18,'Elijah',18,1 UNION SELECT 19,'James',19,1 UNION SELECT 20,'Joseph',20,1 UNION SELECT 21,'Gabriel',21,1 UNION SELECT 22,'Benjamin',22,1 UNION SELECT 23,'Ryan',23,1 UNION SELECT 24,'Samuel',24,1 UNION SELECT 25,'Jackson',25,1 UNION SELECT 26,'John',26,1 UNION SELECT 27,'Nathan',27,1 UNION SELECT 28,'Jonathan',28,1 UNION SELECT 29,'Christian',29,1 UNION SELECT 30,'Liam',30,1 UNION SELECT 31,'Dylan',31,1 UNION SELECT 32,'Landon',32,1 UNION SELECT 33,
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@casidiablo
casidiablo / .gitignore
Created March 25, 2012 20:38
Generic .gitignore
.DS_Store
gen
out
bin
*.iml
*.ipr
*.iws
target
tmp
~apklib*
import java.util.*;
public class Dummy {
private static final Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>();
static {
map.put(120, Arrays.asList(1));
map.put(121, Arrays.asList(2, 3));
map.put(122, Arrays.asList(4, 5, 6));
// 0 - 0,0 | 1 - 1,0 | 2 - 1,1,
// etc.
@casidiablo
casidiablo / not_interesting.user.js
Created April 20, 2012 14:27
Hides interesting notes in Google+
// ==UserScript==
// @name Hides Interesting (Spanish Only)
// @include https://plus.google.com/*
// @version 1.0
// ==/UserScript==
(function () {
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
var link = links[i];
if (/Interesante en Google+/i.test (link.innerHTML) ){
try {
JSONObject jsonObject = new JSONObject("{\"pop_up\":{\"message\":\"Download a FREE game!\",\"conversion_id\":\"4f9ecd02b23e5a00080000fa\",\"bid\":22,\"links\":[{\"rel\":\"clicks\",\"href\":\"https://www.revmob.com/api/v4/conversions/4f9ecd02b23e5a00080000fa/clicks.json\"}]}}");
JSONObject popUp = jsonObject.getJSONObject("pop_up");
JSONArray links = popUp.getJSONArray("links");
JSONObject firstLink = links.getJSONObject(0);
String href = firstLink.getString("href");
System.out.println("::::: PROFIT! "+href);
} catch (JSONException e) {
e.printStackTrace();
}
import android.content.Context;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.TextView;
import com.github.jobs.BuildConfig;
import java.util.ArrayList;
import java.util.List;
@casidiablo
casidiablo / ABC.md
Last active December 14, 2015 10:39
Json Parse Benchmark

Correctness and Performance benchmark for various Java-based JSON libraries

Run the tests

You have to install vogar in order to run the tests againts an Android phone. Once you have set it up, you can run the tests like this:

vogar --benchmark \

--classpath ParseBenchmarkData.zip \

@casidiablo
casidiablo / jar-to-local-mvn.md
Created November 21, 2013 21:19
How to publish a jar to your local maven
mvn install:install-file \
  -Dfile=OoyalaSDK.jar \
  -DgroupId=com.ooyala \
  -DartifactId=ooyala-sdk \
  -Dpackaging=jar -Dversion=2.1.0