Skip to content

Instantly share code, notes, and snippets.

View pablomatiasgomez's full-sized avatar
🚌
Driving a bus

Pablo Matías Gomez pablomatiasgomez

🚌
Driving a bus
View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@pablomatiasgomez
pablomatiasgomez / PrinterTest.java
Created March 11, 2016 15:11
Testing printer open ports
private static final String IP = "10.254.130.140";
public static void main(String[] args) throws UnknownHostException, IOException {
System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "200");
IntStream.range(1, 64000).filter(LocaleResolver::testPort).forEach(System.out::println);
List<Integer> ports = Arrays.asList(5000, 5001, 4000, 8000, 9400, 79, 9200, 9500, 9501, 515, 9100, 9600, 6100, 6110);
@pablomatiasgomez
pablomatiasgomez / mongo-creation-date.js
Created July 24, 2015 14:22
Get the creation date for a generated mongo id
#!/usr/bin/env node
var getDate = function(id) {
return new Date(parseInt(id.toString().slice(0, 8), 16) * 1000);
}
if (process.argv.length > 2) {
process.argv.slice(2).forEach(function (val, i) {
console.log(val + ": " + getDate(val));
});
@pablomatiasgomez
pablomatiasgomez / connections_node.c
Created June 29, 2015 18:01
How to get a deadlock in three simple lines
int connections_node_getActiveConnectedCount() {
pthread_mutex_lock(&activeNodesLock);
return dictionary_size(activeNodesSockets);
pthread_mutex_unlock(&activeNodesLock);
}
@pablomatiasgomez
pablomatiasgomez / DoubleContainer.java
Created June 19, 2015 19:58
Amazing how getValue() trhows java.lang.NullPointerException if value is null
public class DoubleContainer {
private Double value;
public Double getValue() {
return (this.value != null ? Math.ceil(this.value) : this.value);
}
public void setValue(Double value) {
this.value = value;