Skip to content

Instantly share code, notes, and snippets.

David Raviv davidraviv

Block or report user

Report or block davidraviv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@davidraviv
davidraviv / basic_scala_pom.xml
Created Mar 27, 2014
Basic maven pom.xml that allows building a scala project. No need to prior install scala.
View basic_scala_pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>com.wm</groupId>
<artifactId>wmLogger</artifactId>
<version>1.0-SNAPSHOT</version>
@davidraviv
davidraviv / scala_complie_package_pom.xml
Created Mar 27, 2014
Compile and package a scala code to a single jar. Also includes dependencies for json4s that can be omitted.
View scala_complie_package_pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>com.wm</groupId>
<artifactId>wmLogger</artifactId>
<version>1.0-SNAPSHOT</version>
@davidraviv
davidraviv / generate_wsdl_pom.xml
Created Apr 17, 2014
Add this to the build part of a pom.xml to generate wsdl related classes. The wsdl is expected to be locally stored under src/main/resources/wsdl
View generate_wsdl_pom.xml
<build>
<plugins>
<!--Generate wsdl related classes-->
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
@davidraviv
davidraviv / ActionFactory.java
Last active Aug 29, 2015
Simple singleton factory to create class implementing Action interface.The constructor for creating the class is cached internally to reuse in the next invokation.In the className implementation is missing, this factory returns null.* Action is proprietary interface, can be replaced with any other interface. JsonNode is the constructor input for…
View ActionFactory.java
package com.company.product
import com.fasterxml.jackson.databind.JsonNode;
import org.apache.log4j.Logger;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;
/**
@davidraviv
davidraviv / 0_reuse_code.js
Created May 19, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@davidraviv
davidraviv / PrintLogoToConsole.java
Created May 19, 2014
From http://stackoverflow.com/questions/3886201/java-outputting-text-file-to-console Print the content of a text file to the console. I used it to print a logo.
View PrintLogoToConsole.java
try {
// draw logo to console
InputStream input = new BufferedInputStream(new FileInputStream("src/main/resources/logo.txt"));
byte[] buffer = new byte[8192];
try {
for (int length = 0; (length = input.read(buffer)) != -1;) {
System.out.write(buffer, 0, length);
}
} finally {
@davidraviv
davidraviv / HTTPMessage.java
Created May 22, 2014
Simple HTTP sender using java.net
View HTTPMessage.java
package com.x.proxy.http;
import java.io.Serializable;
import java.util.Map;
/**
* Created by davidraviv on 7/5/14.
*/
public class HTTPMessage implements Serializable {
public String url;
@davidraviv
davidraviv / ip.sh
Created Jun 9, 2014
Get a list of your ip's on macosx using ifconfig (no external service)
View ip.sh
#! /bin/bash
ip_lines=`ifconfig | grep "inet "`
prefix="*inet "
suffix=" net*"
while read -r line; do
ip=${line##$prefix}
ip=${ip%%$suffix}
echo "$ip"
done <<< "$ip_lines"
@davidraviv
davidraviv / LocationChanger.plist
Created Jul 14, 2014
Trigger a script on a network change in macosx 1. Move locationchanger to a location of your wish and make it executable. 2. Edit LocationChanger.plist with the location of locationchanger. 3. Move LocationChanger to ~/Library/LaunchAgents/LocationChanger.plist 4. Execute the following on a terminal: launchctl load ~/Library/LaunchAgents/Locatio…
View LocationChanger.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>locationchanger</string>
<key>ProgramArguments</key>
<array>
<string>/Users/davidraviv/bin/locationchanger</string>
View .gitconfig
[user]
name = David Raviv
email = david.raviv@worldmate.com
[core]
autocrlf = input
[credential]
helper = osxkeychain
[color]
ui = auto
You can’t perform that action at this time.