This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mechanize' | |
cert_store = OpenSSL::X509::Store.new | |
cert_store.add_file 'cacert.pem' #get it at https://dl.dropboxusercontent.com/u/947497/cacert.pem | |
a = Mechanize.new do |agent| | |
agent.cert_store = cert_store | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject jetty-async "0.1.0-SNAPSHOT" | |
:description "FIXME: write description" | |
:url "http://example.com/FIXME" | |
:license {:name "Eclipse Public License" | |
:url "http://www.eclipse.org/legal/epl-v10.html"} | |
:dependencies [[org.clojure/clojure "1.7.0"] | |
[com.ninjudd/ring-async "0.2.0"]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def ^:dynamic *indent* 0) | |
(alter-var-root | |
#'clojure.core/load | |
(fn [orig] | |
(fn [& paths] | |
(let [t (System/nanoTime) | |
r (binding [*indent* (inc *indent*)] | |
(apply orig paths))] | |
(binding [*out* *err*] | |
(println (apply str (repeat *indent* " ")) (/ (- (System/nanoTime) t) 1000000.0) paths) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns skynet.main | |
(:require | |
[co.paralleluniverse.pulsar | |
[core :refer :all] | |
[actors :refer :all]]) | |
(:refer-clojure :exclude [promise await]) | |
(:gen-class)) | |
(declare skynet) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// drop all non-system colls | |
db.getCollectionNames().forEach(function(c) { if (c.indexOf("system.") == -1) db[c].drop(); }) | |
// clear old profiles | |
db.setProfilingLevel(0); db.system.profile.drop(); db.setProfilingLevel(1, 100) | |
// view top profile queries | |
db.getCollection('system.profile').find({}, {ns: 1, query:1, millis:1, command: 1}).sort({millis:-1}) | |
//slow queries starting from a given date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# outbound, actually all | |
sudo tcpflow -C -i any -e all port 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deleteImageWithTagAndHash(registryHost, imageName, tag, hash) | |
puts "Deleting..." | |
res = `curl -X DELETE -I http://#{registryHost}/v2/#{imageName}/manifests/#{hash}` | |
puts "curl -X DELETE -I http://#{registryHost}/v2/#{imageName}/manifests/#{hash}" | |
puts "Deleted image with tag #{tag}" | |
end | |
def getDigestForImageAndTag(registryHost, imageName, tag) | |
puts 'Processing...' | |
digestHash = `curl -s -I -X HEAD -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' http://#{registryHost}/v2/#{imageName}/manifests/#{tag} | sed -n 's/Docker-Content-Digest://p'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# shared history: http://unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows#3055135 | |
# | |
HISTCONTROL=ignoredups:erasedups # no duplicate entries | |
HISTSIZE=100000 # big big history | |
HISTFILESIZE=100000 # big big history | |
shopt -s histappend # append to history, don't overwrite it | |
#st should be a function to pass args | |
st(){ sublime-text $* |