Skip to content

Instantly share code, notes, and snippets.

@jeremychase
jeremychase / example.go
Last active December 17, 2018 16:24
Example of initializing and sharing package scoped variable
// This package shows a non-concurrent safe way to initialize and
// share a package scoped variable.
package example
// package scoped variable initialized in GetClient().
// its type is not important
var pkgScopedVar []byte
// Client is used for its methods
JAVA_OPTS=""
JAVA_OPTS="${JAVA_OPTS} -Xms3G"
JAVA_OPTS="${JAVA_OPTS} -Xmx3G"
JAVA_OPTS="${JAVA_OPTS} -Xmn1g"
JAVA_OPTS="${JAVA_OPTS} -XX:ReservedCodeCacheSize=512M"
export JAVA_OPTS
- get_url: url=http://downloads.typesafe.com/play/{{ item.version }}/play-{{ item.version }}.zip dest={{ play_dl_dir }} sha256sum={{ item.sum }}
with_items:
- { "version":2.2.1, "sum":a4a453cdd5f36d608eddeceaa04f7b8117e8883a89f308eb34a7f740cb8bf78b }
# check-war.yml has several actions, so I don't want duplicated with_items on each
- include: check-war.yml target={{item.name}} buildnumber={{item.buildnumber}}
with_items:
- { "name":foo, "buildnumber":$foo_buildnumber }
- { "name":bar, "buildnumber":$bar_buildnumber }
// TODO this should done as an unmanaged something like this http://www.scala-sbt.org/release/docs/Howto/generatefiles.html
compileAvroSchemas := {
Seq("bash", "-c", "java -jar " + Path.userHome.absolutePath + "/.ivy2/cache/org.apache.avro/avro-tools/jars/avro-tools-" + avroVersion + ".jar compile schema example/src/main/config/schemas/* example/src/main/java") !
}
// TODO This is far from ideal and should use the sbt managedSources
lazy val myClean = taskKey[Unit]("Clean generated files")
myClean := {
Seq("bash", "-c", "rm example/src/main/java/example.com/serialization/generated/*") !
@jeremychase
jeremychase / gist:7274545
Last active December 27, 2015 05:29
clicking bad shady accountant
javascript:$('.ratio-info').remove();
$('#clickers .s_div, #sellers .s_div').each(
function(index, div) {
var divname = $(div).attr('id');
var rawCost = $('#' + divname + '_cst').text();
var rawRps = $('#' + divname + '_rps').text();
var costMulti = 1;
var rpsMulti = 1;
@jeremychase
jeremychase / gist:7174856
Created October 26, 2013 21:35
Example ansible hosts file.
example-name ansible_ssh_host=10.0.1.14
[foo-servers]
example-name
@jeremychase
jeremychase / gist:7153913
Last active December 26, 2015 12:49
Making war deployment idempotent, but this feels a little fishy.
- name: MD5 current WAR
shell: md5sum /var/lib/tomcat7/webapps/ROOT.war | awk '{print $1}'
register: md5_old
- name: MD5 new WAR
shell: md5sum /tmp/ROOT-{{ apiresult.json.number }}.war | awk '{print $1}'
register: md5_new
- name: Notifying install-war because WARs differ
command: 'true' # An action is required, so do nothing.
20:19 -!- L is now known as Guest10290
20:19 < Anastasius> HELLO
20:20 < Guest10290> Anastasius HELLO IM WRITTING FROM SPAIN
20:21 < Guest10290> IM TRYING TO TALK WITH ANYBODY ABOUT ONE VERY IMPORTANT THING.
20:21 < Guest10290> SORRY MY ENGLISH IF I DO NOT KNOW HOW TO EXPLAIN
20:21 < Anastasius> Cool. Can you do it without the caps lock?
20:22 < Guest10290> sure sorry.
20:22 < Anastasius> :)
20:22 < Guest10290> so, im locking for scientist
20:22 < Guest10290> looking