Skip to content

Instantly share code, notes, and snippets.

(defn setup-hetzner-kvm-server
"Set up a fresh hetzner box to act as a KVM server"
[hostname]
(println (format "Performing initial setup for %s" hostname))
(hetzner-initial-setup hostname)
(println "Sleeping 2mins to enable remote host to reboot..")
(Thread/sleep (* 2 60 1000)) ;; wait for the host to reboot
(println (format "Setting up %s as a KVM server.." hostname))
(configure-kvm-server hostname)
(println (format "Done with %s" hostname)))
clojure.lang.ExceptionInfo: Don't know how to add identity
at clj_ssh.ssh$add_identity.invoke(ssh.clj:185) ~[na:na]
at pallet.ssh.transport$possibly_add_identity.invoke(transport.clj:24) ~[na:na]
at pallet.ssh.transport$ssh_user_credentials.invoke(transport.clj:36) [na:na]
at pallet.transport.ssh$open.invoke(ssh.clj:57) [na:na]
at pallet.transport.ssh.SshTransport.open(ssh.clj:65) [na:na]
at pallet.ssh.execute$get_connection.invoke(execute.clj:58) [na:na]
at pallet.ssh.execute$ssh_script_on_target.invoke(execute.clj:76) [na:na]
at pallet.executors$default_executor.invoke(executors.clj:63) [na:na]
at pallet.action_plan$execute_action_map.invoke(action_plan.clj:596) [na:na]
@sundbp
sundbp / dsl-example.clj
Created October 3, 2012 17:05
draft DSL
; indicate that there will be someting called a future
;
; can use to prepare space in some global structure for all known
; entity tupes and things like that.
;
; also use it to create default constructor and convenience
; type methods
;
; also makes it possible to stick in a documentation string as well
(def-entity future
@sundbp
sundbp / notes
Created August 2, 2012 11:30
Notes for binding_of_caller jruby support
- Perhaps can get to it without any java code: https://gist.github.com/1680784
- Interpreter only flags: https://github.com/quix/boc/blob/master/jext/boc/BocService.java
Code sections that are relevant:
- Kernel#binding: return RubyBinding.newBinding(context.runtime, context.currentBinding());
- ThreadContext:
- 1223 public Binding currentBinding(IRubyObject self) {
- 1224 Frame frame = getCurrentFrame();
- 1225 return new Binding(self, frame, frame.getVisibility(), getRubyClass(), getCurrentScope(), backtrace[backtraceIndex].clone());
@sundbp
sundbp / dijkstra_example.rb
Created June 29, 2012 15:13
Injectionless DCI in ruby - Dijkstra example
# Example similar to the example at http://www.fulloo.info/Examples/RubyExamples/Dijkstra/DijkstraListing.html
@sundbp
sundbp / frontloader_example.rb
Created June 29, 2012 14:31
Injectionless DCI in ruby - Front loader example
# Example similar to the Marvin version presented at http://www.fulloo.info/Examples/Marvin/FrontLoader/
@sundbp
sundbp / injectionless_dci.rb
Created June 29, 2012 10:02
DCI in ruby without injection (using DSL) - MoneyTransfer example
# Buidling blocks to support injectionless DCI
require 'rubygems'
require 'active_support/core_ext/string/inflections'
#require 'pry'
module ContextAccessor
def context
Thread.current[:context]
end
end
@sundbp
sundbp / gist:2507835
Created April 27, 2012 09:38
mutex problem in sinatra app using datamapper on TB 2.0.1
10:06:17,243 ERROR [stderr] (http--127.0.0.1-8080-2) ThreadError - Mutex relocking by same thread:
10:06:17,243 ERROR [stderr] (http--127.0.0.1-8080-2) /home/gap/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/data_objects-0.10.8/lib/data_objects/pooling.rb:172:in `new'
10:06:17,245 ERROR [stderr] (http--127.0.0.1-8080-2) /home/gap/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/data_objects-0.10.8/lib/data_objects/pooling.rb:119:in `new'
10:06:17,246 ERROR [stderr] (http--127.0.0.1-8080-2) /home/gap/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/data_objects-0.10.8/lib/data_objects/pooling.rb:177:in `new'
10:06:17,246 ERROR [stderr] (http--127.0.0.1-8080-2) /home/gap/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/data_objects-0.10.8/lib/data_objects/pooling.rb:172:in `new'
10:06:17,246 ERROR [stderr] (http--127.0.0.1-8080-2) /home/gap/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/data_objects-0.10.8/lib/data_objects/pooling.rb:119:in `new'
10:06:17,247 ERROR [stderr] (http--127.0.0.1-
server {
listen 80; ## listen for ipv4; this line is default and implied
location ^~ /(javascripts|stylesheets|images)/ {
root /home/gap/tb_apps/gap_app/public;
}
location ^~ favicon {
root /home/gap/tb_apps/gap_app/public;
}
location / {
@sundbp
sundbp / output
Created March 26, 2012 15:54
output showing no torquebox_init.rb output
/bin/sh bin/standalone.sh -Djruby.home=/home/pts/.rbenv/versions/jruby-1.6.7
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /home/pts/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/torquebox-server-2.0.0.cr1-java/jboss
JAVA: java
JAVA_OPTS: -server -XX:+TieredCompilation -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml