Skip to content

Instantly share code, notes, and snippets.

@Toady00
Toady00 / graft.sh
Created August 22, 2013 20:42
Process for grafting svn commits to git repo after cloning with the --no-metadata option.
# This assumes you prefixed all the svn branches with 'svn/' via the
# --prefix=svn/ option when you performed the initial clone. Otherwise
# replace 'svn/trunk' with the name of your branch that corresponds to
# trunk.
git svn fetch --revision [start_revision_number]:[end_revision_number]
GRAFT_PARENT_GIT=`git log --pretty=format:'%H' -1 master
GRAFT_FIRST_SVN=`git log --pretty=format:'%H' svn/trunk | tail -n` # or whatever you called your trunk
echo $GRAFT_PARENT_GIT $GRAFT_FIRST_SVN > .git/info/grafts
git checkout master
@Toady00
Toady00 / example_usage.rb
Last active January 2, 2016 23:49
I wrote it, but I'm not sure I like it?
# Dynamically creating the correct url for downloading elasticsearch package via version number
download_url = "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.10.deb" # can we say elasticsearch one more time?
template = '<%= "https://download.#{@domain}.org/#{@domain}/#{@domain}/#{@domain}-#{@major}.#{@minor}.#{@patch}.deb" %>'
vars = {domain: 'elasticsearch', major: 0, minor: 90, patch: 10}
url_template = UrlTemplate.new(template, vars)
url_template.url == download_url
@Toady00
Toady00 / .inputrc
Created February 27, 2014 21:10
inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
@Toady00
Toady00 / orientdb_stack_trace.txt
Created April 18, 2014 19:52
orientdb stack trace
# com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynchClient.throwSerializedException(OChannelBinaryAsynchClient.java:264)
# com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynchClient.handleStatus(OChannelBinaryAsynchClient.java:231)
# com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:202)
# com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:113)
# com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:1952)
# com.orientechnologies.orient.client.remote.OStorageRemote.openRemoteDatabase(OStorageRemote.java:1597)
# com.orientechnologies.orient.client.remote.OStorageRemote.open(OStorageRemote.java:201)
# com.orientechnologies.orient.client.remote.OStorageRemoteThread.open(OStorageRemoteThread.java:80)
# com.orientechnologies.orient.core.db
@Toady00
Toady00 / yellow-es-nodes.sh
Created April 24, 2014 14:57
I've got 3 es nodes on ec2. I added ebs volume to each (1 at a time), stopped es, copied data/log to the new volume, edited config file to point to new location, and restarted es. Each time the cluster went green within a few seconds. I forgot to change the config file on the second one, so I edited it, and restarted es again. After that, the cl…
# Before data migration
curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
# {
# "cluster_name" : "abc_cluster",
# "status" : "green",
# "timed_out" : false,
# "number_of_nodes" : 3,
# "number_of_data_nodes" : 3,
# "active_primary_shards" : 20,
@Toady00
Toady00 / stace_trace
Created May 30, 2014 14:09
Torquebox Thread Dump showing 8 blocked web threads
2014-05-30 11:18:30
Full thread dump Java HotSpot(TM) 64-Bit Server VM (23.25-b01 mixed mode):
"Attach Listener" daemon prio=10 tid=0x00007f3468027000 nid=0x4257 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"http-/10.211.50.32:8080-11" daemon prio=10 tid=0x00007f345089b000 nid=0x40a6 waiting for monitor entry [0x00007f345c7e5000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.torquebox.core.pool.SimplePool.borrowInstance(SimplePool.java:68)
- waiting to lock <0x0000000742a354d8> (a java.lang.Object)
@Toady00
Toady00 / KV.rb
Created June 29, 2014 23:34
Ruby Class for getting and setting Consul KeyValues
require 'base64'
require 'json'
require 'rest_client'
module Consul
class KV
URL = "http://localhost:8500/v1/kv"
attr_reader :key,
:create_index,
@Toady00
Toady00 / aggregated_app.log
Last active August 29, 2015 14:04
TB Singleton jobs that aren't
# app 1 logs
Jul 18 15:14:19 prod-app-01 -: **** CardApprovalMailer Starting ****
Jul 18 15:14:19 prod-app-01 -: **** CardApprovalMailer Finished ****
# app 2 logs
Jul 18 15:14:49 prod-app-02 -: **** CardApprovalMailer Starting ****
Jul 18 15:14:49 prod-app-02 -: **** CardApprovalMailer Finished ****
# app 3 logs
Jul 18 15:14:51 prod-app-03 -: **** CardApprovalMailer Starting ****
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /opt/torquebox/current/jboss
JAVA: java
JAVA_OPTS: -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true
==> /Users/brandon/Library/Containers/com.docker.docker/Data/logs/2016-04-13/com.docker.driver.amd64-linux.log <==
2016-04-13T20:48:58.715775-04 Info - proxy >> POST /images/create?fromImage=redis&tag=latest
2016-04-13T20:48:58.715879-04 Info - Dial /tmp/u.socket
2016-04-13T20:48:58.715950-04 Info - Dial IP /tmp/u.socket
==> /Users/brandon/Library/Containers/com.docker.docker/Data/logs/2016-04-13/com.docker.slirp.log <==
2016-04-13T20:48:58.727232-04 Error - com.docker.slirp: [INFO] unix:/tmp/u2.socket:192.168.64.2:2375: connected
==> /Users/brandon/Library/Containers/com.docker.docker/Data/logs/2016-04-13/com.docker.driver.amd64-linux.log <==
2016-04-13T20:49:00.088432-04 Info - proxy << POST /images/create?fromImage=redis&tag=latest