Skip to content

Instantly share code, notes, and snippets.

View chrisvest's full-sized avatar
🍉

Chris Vest chrisvest

🍉
View GitHub Profile

This is a very simple approach to doing role-based access control with Neo4j. It is optimistic, in the sense that all items are assumed to be world-accessible unless they have specific constraints. Item visibility can be constrained to either individual users or all users who belong to a role. Roles are also hierarchical, so can inherit privileges from other roles.

First, lets create our basic example data:

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
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

;; 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)))))