Skip to content

Instantly share code, notes, and snippets.

View rf's full-sized avatar

Russ Frank rf

  • Oden Technologies
  • Brooklyn, NY
View GitHub Profile
Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
Debian clang version 11.0.1-2~bpo10+1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/rf/oden/ClickHouse/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/ninja" "cmTC_fdbad"
[1/2] Building C object CMakeFiles/cmTC_fdbad.dir/CheckSymbolExists.c.o
@rf
rf / example usage
Created November 5, 2013 20:58
PDF links on Android in Titanium
var wv = Ti.UI.createWebView();
var pdf = require('pdf');
wv.addEventListener('pdf', function (event) {
pdf(event.url, event.cookies, function (err) {
if (err) alert(err);
});
});
@rf
rf / convert.js
Last active May 20, 2016 18:15
Symbolicate linux perf output of a node program using the v8 log
var fs = require('fs');
var infile = process.argv[2];
if (!infile) return console.log("need infile");
var data = fs.readFileSync(infile, 'utf8').split('\n');
var outlines = [];
data.forEach(function(item) {
$ cat thing.s
.section __TEXT,__text,regular,pure_instructions
.globl _main
.align 4, 0x90
_main: ## @main
.cfi_startproc
## BB#0:
pushq %rbp
Ltmp2:
.cfi_def_cfa_offset 16
aaniti
eding
omenservan
husel
divid
ncefor
monit
andfu
roceeding
despis
onfou
eventerpretatio
rlahair
machpel
tledo
curselv
darkne
elchized
imelec
ffend
(defn lookup
"Lookup a variable in the model. Respects inversion of the variable if it is
specified with a - symbol. Returns nil if the variable is unset."
[v model]
(if (= (get v 0) \-) ; If the first character is '-'
(let [value (get model (subs v 1))] ; let value equal the value of the var
(if (nil? value) ; if the variable is unnassigned
nil ; return nil
(not value))) ; otherwise return not value
(defn lookup
"Lookup a variable in the model. Respects inversion of the variable if it is
specified with a - symbol. Returns nil if the variable is unset."
[v model]
(if (= (get v 0) \-) ; If the first character is '-'
(let [value (get model (subs v 1))] ; let value equal the value of the var
(if (identical? value nil) ; if the variable is unnassigned
nil ; return nil
(not value))) ; otherwise return not value
(defn lookup [v model]
"Lookup a variable in the model. Respects inversion of the variable if it is
specified with a - symbol. Returns nil if the variable is unset."
(if (= (get v 0) \-) ; If the first character is '-'
(let [value (get model (subs v 1))] ; let value equal the value of the var
(if (identical? value nil) ; if the variable is unnassigned
nil ; return nil
(not value))) ; otherwise return not value
(get model v)))