Instantly share code, notes, and snippets.

View output.log
** (Mix) httpc request failed with: :socket_closed_remotely
Could not install Hex because Mix could not download metadata at https://repo.hex.pm/installs/hex-1.x.csv.signed.
10:05:53.111 [error] Failed updating session:
ProfileName: :httpc_mix
SessionId: {{'repo.hex.pm', 443}, #PID<0.111.0>}
Pos: 7
Value: 0
View thread_dump.md

Thread 1: main (WAITING)

sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:997)
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
akka.actor.ActorSystemImpl$TerminationCallbacks.ready(ActorSystem.scala:817)
akka.actor.ActorSystemImpl$TerminationCallbacks.ready(ActorSystem.scala:786)
View calculate_dnn.sh
#!/bin/sh
spark-submit \
--class org.alitouka.spark.dbscan.exploratoryAnalysis.DistanceToNearestNeighborDriver \
--master yarn \
--deploy-mode cluster \
--driver-cores 4 \
--num-executors 10 \
--executor-memory 8g \
--executor-cores 4 \
--conf spark.yarn.executor.memoryOverhead=1024 \
View subclass_include.rb
module Foo
def self.included base
puts "Included by #{base}"
end
end
class Bar
include Foo
def self.inherited(base)
View emacs-clojure.md

CIDER Commands

C-c +

  • M-j: Jack into an nREPL session and open a REPL buffer.
  • M-n: Switch REPL to the current buffer's namespace.
  • C-z: Open REPL and move cursor to REPL.
  • C-o: Clear the last line's output.
  • M-o: Clear all the output
View function.rb
def function(a)
a.group_by.inject({}) do |hash, (key,val)|
hash[key] = val.count if val.count > 1
hash
end
end
View facebook_bootstrap_template.rb
ruby_version = ask("What ruby version is your app?")
ruby_gemset = ask("What do you want to name your gemset?")
file(".ruby-version", ruby_version)
file(".ruby-gemset", ruby_gemset)
gem 'haml-rails'
gem 'bootstrap-sass'
View output.log
Resetting...
Resetting stock for product 22 to 104 units.
(1 row(s) affected)
Removing order (OrderID=11077, ProductID=22).
(1 row(s) affected)
Adding order to Order Details table for 50 units of product 22.
(1 row(s) affected)
View id3.clj
(defn build-id3-tree
"Builds an ID3 Decision tree to find target-attr based on the examples"
[examples target-attr attributes]
(cond
(same? target-attr examples) { :label (target-attr (first examples)) }
(empty? attributes) { :label (most-common target-attr examples) }
:else (let [attr (max-val #(information-gain % examples) attributes)
groups (group-by attr examples)
child-agent (agent {})]
(loop [[value subset] (first groups)
View closure.rb
class Closure
attr_reader :formals, :bodies, :env
def initialize(formals, bodies, env)
@formals = Array(formals)
@bodies = Array(bodies)
@env = env
end
def call(*args)
raise argument_error(args) if args.length != formals.length