Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am elifarley on github.
  • I am elifarley (https://keybase.io/elifarley) on keybase.
  • I have a public key whose fingerprint is BC7E 5B5D 4A0F A9EF ACB2 BC4F CE2A D059 C465 A677

To claim this, I am signing this object:

package java.net;
public class GetLocalHostInfo {
public static InetAddressImpl impl;
public static void main( final String[] args ) {
try {
InetAddress.getLoopbackAddress();
@elifarley
elifarley / jira-curl.sh
Last active May 14, 2019 08:48 — forked from TheMightyLlama/jira-curl.sh
How to use curl and here-documents to post a JSON document to create an issue in Jira in a more readable way
JIRA_REST_URL="${JIRA_REST_URL:-https://MYCOMPANY.jira.com/rest/api/2}"
JIRA_CREDENTIALS="${JIRA_CREDENTIALS:-user:password}"
# https://developer.atlassian.com/jiradev/api-reference/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-discovering-meta-data-for-creating-issues
# https://MYCOMPANY.jira.com/rest/api/2/issue/createmeta?projectKeys=MYPROJ&issuetypeNames=MyIssueType&expand=projects.issuetypes.fields
# customfield_10171: My Custom Field Name 1
# customfield_10172: My Custom Field Name 2
# This methods create a new issue of type 'MyIssueType' in project 'MYPROJ' with 2 custom fields
<settingsSecurity>
<relocation>/Volumes/usb-key/settings-security.xml</relocation>
</settingsSecurity>
package org.ecc.numericnotation;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.Arrays;
/**
*
@elifarley
elifarley / jstatd.sh
Created April 20, 2015 20:05
JVM monitoring
# On remote server:
echo 'grant codebase "file:${java.home}/../lib/tools.jar" { permission java.security.AllPermission; };' > /tmp/tools.policy
sudo -u jboss $JDK_HOME/bin/jstatd -J-Djava.rmi.server.hostname=$(hostname -i) -J-Djava.security.policy=/tmp/tools.policy
@elifarley
elifarley / 0: jvm-options-java8.conf
Last active January 5, 2024 07:52
JVM options to maximize performance
# See https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html
# See https://docs.oracle.com/javase/8/docs/technotes/guides/vm/performance-enhancements-7.html
# See https://docs.oracle.com/javase/8/embedded/develop-apps-platforms/codecache.htm
# See http://normanmaurer.me/blog_in_progress/2013/11/07/Inline-all-the-Things/
# See http://stas-blogspot.blogspot.com.br/2011/07/most-complete-list-of-xx-options-for.html
# -XX:+LogCompilation
# -XX:+PrintInlining
-Dfile.encoding=UTF-8
@elifarley
elifarley / mercurial.ini
Last active August 29, 2015 14:18
Some useful aliases for Mercurial DVCS
# Save this file as %USERPROFILE%\mercurial.ini or ~/.hgrc
[alias]
nudge = push --rev .
clean = clean --abort-on-err
cleana = clean --all
qic = !%HG% qimport -r .:: && %HG% qpop -a $@
qfa = !%HG% qpush -a $@ && %HG% qfinish -a
metaimport = !%HG% export $@ | %HG% import --user "%HGUSER%" --bypass -
metaimportnc = !%HG% export $@ | %HG% import --user "%HGUSER%" --no-commit --similarity 50 -
@elifarley
elifarley / 0_reuse_code.js
Last active August 29, 2015 14:18
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
@elifarley
elifarley / reql.py
Last active August 29, 2015 14:16 — forked from RedBeard0531/functions.js
Compute sample standard deviation, coefficient of variation and other stats over large datasets in RethinkDB using Map-Reduce in ReQL. See https://github.com/rethinkdb/rethinkdb/issues/3769#issuecomment-77229538
> load('functions.js')
> db.stuff.drop()
false
> db.stuff.insert({value:1})
> db.stuff.insert({value:2})
> db.stuff.insert({value:2})
> db.stuff.insert({value:2})
> db.stuff.insert({value:3})
> db.stuff.mapReduce(map, reduce, {finalize:finalize, out:{inline:1}}).results[0]
{