This file contains hidden or 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 thread-utils) | |
(def ^:private frame-prev-field (doto (.getDeclaredField clojure.lang.Var$Frame "prev") (.setAccessible true))) | |
(def ^:private bindings-field (doto (.getDeclaredField clojure.lang.Var$Frame "bindings") (.setAccessible true))) | |
(def ^:private tbox-val-field (doto (.getDeclaredField clojure.lang.Var$TBox "val") (.setAccessible true))) | |
(def ^:private thread-locals-field (doto (.getDeclaredField Thread "threadLocals") (.setAccessible true))) | |
(def ^:private thread-local-map-field (doto (.getDeclaredField java.lang.ThreadLocal$ThreadLocalMap "table") (.setAccessible true))) | |
(def ^:private entry-value-field (doto (.getDeclaredField java.lang.ThreadLocal$ThreadLocalMap$Entry "value") (.setAccessible true))) | |
(defn all-threads [] |
This file contains hidden or 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
(defn osgi-bundle-handler | |
"If the namespace currently associated with this REPL has an OSGi | |
bundle associated, use this to set osgi/*bundle* and | |
clojure.lang.Compiler/LOADER." | |
[h] | |
(fn [msg] | |
(let [ns-meta (meta (get (deref (:session msg)) #'clojure.core/*ns*)) | |
bundle (and ns-meta (:clojure.osgi.core/bundle ns-meta)) | |
classloader (or (:repl-classloader ns-meta) | |
(and bundle (osgi/bundle-class-loader bundle))) |
This file contains hidden or 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
# added in WSGI handler run by uUWSGI | |
import sys | |
import os.path | |
try: | |
import uwsgi | |
import threading | |
stack_dump_file = '/tmp/stack-dump-trigger' ## given as an example; put this somewhere better than /tmp |
This file contains hidden or 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
import contextlib | |
@contextlib.contextmanager | |
def trace_to_stderr(name): | |
"""Trivial proof-of-concept for tracing template rendering""" | |
print >>sys.stderr, 'ENTER: %s' % (name,) | |
yield | |
print >>sys.stderr, 'EXIT: %s' % (name,) | |
class trace_decorator(object): | |
def __init__(self, contextmgr_type, item_type, item_name, *args, **kwargs): |
This file contains hidden or 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
Veewee::Session.declare( { | |
:cpu_count => '1', :memory_size=> '384', | |
:disk_size => '10140', :disk_format => 'VDI', | |
:os_type_id => 'RedHat', | |
:iso_file => "CentOS-6.0-i386-bin-DVD.iso", :iso_src => "", :iso_md5 => "d7e57d6edaca1556d5bad2fa88602309", :iso_download_timeout => 1000, | |
:boot_wait => "10",:boot_cmd_sequence => ['<Esc>', 'linux text ks=http://%IP%:%PORT%/ks.cfg<Enter>'], | |
:kickstart_port => "7122", :kickstart_timeout => 10000,:kickstart_file => "ks.cfg", | |
:ssh_login_timeout => "100",:ssh_user => "vagrant", :ssh_password => "vagrant",:ssh_key => "", | |
:ssh_host_port => "7222", :ssh_guest_port => "22", | |
:sudo_cmd => "echo '%p'|sudo -S sh '%f'", |
This file contains hidden or 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
$ rvm gemset create vagrant | |
'vagrant' gemset created (/home/cduffy/.rvm/gems/ruby-1.8.7-p352@vagrant). | |
$ rvm gemset use vagrant | |
$ cd ~/VC/vagrant | |
~/VC/vagrant$ gem install bundler --pre | |
Fetching: bundler-1.1.pre.5.gem (100%) | |
Successfully installed bundler-1.1.pre.5 | |
1 gem installed | |
Installing ri documentation for bundler-1.1.pre.5... | |
Installing RDoc documentation for bundler-1.1.pre.5... |
This file contains hidden or 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
reading=0 | |
while read; do | |
if [[ $REPLY = *BEGIN* ]]; then | |
current_cert="" | |
reading=1 | |
fi | |
if (( reading )) ; then | |
current_cert+="$REPLY"$'\n' | |
fi |
This file contains hidden or 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
#!/bin/bash | |
while read -r diff | |
do | |
echo "$diff" | |
done < <(comm -12 <(sort db) <(sort dbnew))) |
This file contains hidden or 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
#!/bin/bash | |
# | |
# Parse Mozilla's certdata.txt and extract CA Root Certificates into PEM | |
# format. | |
# | |
# Based on http://curl.haxx.se/mail/lib-2004-07/0134.html; cleaned up to | |
# follow fewer worst practices for bash :) | |
# | |
# certdata.txt can be found in Mozilla's source tree: | |
# /mozilla/security/nss/lib/ckfw/builtins/certdata.txt |
This file contains hidden or 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
#node is an already known package. node.js have dot in name, so "nodejs" | |
#is a better name | |
#some ideas are taken from | |
#http://blog.fpmurphy.com/2010/12/node-js-and-npm-on-fedora-14.html | |
Name: nodejs | |
Version: 0.4.0 | |
Release: 0%{?dist} | |
Summary: JavaScript server-side network application development | |
Group: Development/Languages/Other | |
License: MIT |