Skip to content

Instantly share code, notes, and snippets.

View bveliqi's full-sized avatar
🤙
wuuzzzzuuuuupppppp?!

Behar Veliqi bveliqi

🤙
wuuzzzzuuuuupppppp?!
View GitHub Profile
@bveliqi
bveliqi / behar.js
Created October 23, 2012 15:02
my first gist
var ww = new WebWorker();
@bveliqi
bveliqi / Decorator.py
Created September 14, 2013 09:42
A simple python decorator.
def logcall(f):
def wrapper(*a, **opts):
print('calling ' + f.__name__)
f(*a, **opts)
print('called ' + f.__name__)
return wrapper
@logcall
def square(x):
@bveliqi
bveliqi / Application.java
Created December 18, 2013 21:34
Play WebSocket
public static WebSocket<String> pingWs() {
return new WebSocket<String>() {
@Override
public void onReady(In<String> in, Out<String> out) {
in.onMessage(new F.Callback<String>() {
@Override
public void invoke(String s) throws Throwable {
System.out.println(s);
}
@bveliqi
bveliqi / gist:8257327
Created January 4, 2014 16:54
JAXBContext
/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/bin/java -ea -Didea.launcher.port=7533 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 12.app/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA 12.app/lib/idea_rt.jar:/Applications/IntelliJ IDEA 12.app/plugins/junit/lib/junit-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/lib/javafx-doclet.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Conte
@bveliqi
bveliqi / NineflatsClient.java
Created January 11, 2014 00:40
RESTEasy JAX-RS 2.0 Client
ResteasyClient client = new ResteasyClientBuilder().build();
ResteasyWebTarget target = client.target(serviceRootUrl);
target = target.path("places")
.queryParam("client_id", authKey)
.queryParam("search[query]", cityName)
.queryParam("search[start_date]", fromDate)
.queryParam("search[end_date]", toDate)
.queryParam("search[price_min]", priceMin)
.queryParam("search[price_max]", priceMax)
.queryParam("search[number_of_beds]", numberOfGuests)
@bveliqi
bveliqi / 0_reuse_code.js
Created January 17, 2014 21:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
{
ok: true,
status: 200,
name: "Evilhawk‎",
version: {
number: "0.90.10",
build_hash: "0a5781f44876e8d1c30b6360628d59cb2a7a2bbb",
build_timestamp: "2014-01-10T10:18:37Z",
build_snapshot: false,
lucene_version: "4.6"
@bveliqi
bveliqi / number_of_connections_linux.snippets
Created August 15, 2014 08:39
List and count number of connections to other machines
lsof -i4 | grep -i ipv4 | grep -o -- '->.*' | sort | uniq -c | sort -g
./bin/spark-submit --class de.veliqi.scala.logprocessor.App --deploy-mode client --master spark://Behars-MacBook-Pro.local:7077 ~/Documents/workspace/logprocessor/target/logprocessor-0.0.1-SNAPSHOT-jar-with-dependencies.jar
log4j:WARN No appenders could be found for logger (kafka.utils.VerifiableProperties).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.lang.NoSuchMethodError: scala.Predef$.ArrowAssoc(Ljava/lang/Object;)Ljava/lang/Object;
at kafka.producer.ProducerStats.<init>(ProducerStats.scala:24)
at kafka.producer.ProducerStatsRegistry$$anonfun$1.apply(ProducerStats.scala:34)
at kafka.producer.ProducerStatsRegistry$$anonfun$1.apply(ProducerStats.scala:34)
at kafka.utils.Pool.getAndMaybePut(Pool.scala:61)
at kafka.producer.ProducerStatsRegistry$.getProducerStats(ProducerStats.scala:38)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.veliqi.scala</groupId>
<artifactId>logprocessor</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>My wonderfull scala app</description>
<inceptionYear>2015</inceptionYear>
<licenses>
<license>