Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Adams cadams500

View GitHub Profile
View macos-setjdk
alias jdkls='/usr/libexec/java_home -V 2>&1 | grep -E "\d.\d.\d_\d\d" | cut -d , -f 1 | colrm 1 4 | grep -v Home'
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
function setjdk() {
export JAVA_HOME=$(/usr/libexec/java_home -v $1)
export PATH=$JAVA_HOME/bin:$PATH
java -version
}
@cadams500
cadams500 / eds-api-getdomains.java
Last active Dec 18, 2015
Example eDataSource API Usage
View eds-api-getdomains.java
/*
* VERY raw way to read a restful API endpoint.
* This code can be refined and made into a very simple REST library quite easily.
*
* Code has not been tested and should be taken as pseudo-code.
*/
String apiKey = "myapi-key";
URL url = new URL("http://api.emaildatasource.com/service/2.0.0/rest/api.service.engagements?method=getAvailableDomains&api-key=" + apiKey);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
View mysql-multi-table-delete
delete
from
t1, t2, t3
using
t1
join
t2 on t1.id = t2.id
join
t3 on t2.id = t3.id
where
@cadams500
cadams500 / git-tag-sync
Created Feb 24, 2012
Synchronize Git Tags With Remote
View git-tag-sync
git tag -l | xargs git tag -d
git fetch