Skip to content

Instantly share code, notes, and snippets.

View chrisvest's full-sized avatar
🍉

Chris Vest chrisvest

🍉
View GitHub Profile
@chrisvest
chrisvest / Notes.md
Created June 14, 2012 20:56 — forked from rednaxelafx/JDK5u22_client.log
PrintCompilation on different versions of HotSpot VM

About PrintCompilation

This note tries to document the output of PrintCompilation flag in HotSpot VM. It was originally intended to be a reply to a blog post on PrintCompilation from Stephen Colebourne. It's kind of grown too big to fit as a reply, so I'm putting it here.

Written by: Kris Mok rednaxelafx@gmail.com

Most of the contents in this note are based on my reading of HotSpot source code from OpenJDK and experimenting with the VM flags; otheres come from HotSpot mailing lists and other reading materials listed in the "References" section.

This

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
;; chrisvest's solution to For the win
;; https://4clojure.com/problem/145
(range 1 38 4)
;; chrisvest's solution to A nil key
;; https://4clojure.com/problem/134
#(nil? (%1 %2 1))
@chrisvest
chrisvest / stupid.js
Created December 14, 2011 10:40 — forked from igstan/stupid.js
Stupid way to write a negate if statement without the logical negation operator
var b = false;
if (b^b&b|b) {} else {
println("false branch");
}
;; chrisvest's solution to Cartesian Product
;; https://4clojure.com/problem/90
#(set (for [a %1 b %2] [a b]))
;; chrisvest's solution to http://4clojure.com/problem/83
#(= (set %&) #{true false})
;; chrisvest's solution to http://4clojure.com/problem/81
#(set (filter %1 %2))
;; chrisvest's solution to http://4clojure.com/problem/80
#(let [ntz (Integer/numberOfTrailingZeros %1)]
(= (bit-shift-right %1 ntz) (dec (bit-shift-left 1 (inc ntz)))))
;; chrisvest's solution to http://4clojure.com/problem/80
#(let [ntz (Integer/numberOfTrailingZeros %1)
nlz (Integer/numberOfLeadingZeros %1)]
(= ntz (- 31 ntz nlz)))