Skip to content

Instantly share code, notes, and snippets.

.PHONY: all check-syntax
all:
g++ $(CFLAGS) -Wall -Wextra -funroll-loops -O3 -pthread -march=native -mtune=native -o run *.c
check-syntax:
$(CC) $(CFLAGS) -Wall -Wextra -0pedantic -fsyntax-only $(CHK_SOURCES)
@JoelHough
JoelHough / firework-link.js
Created October 16, 2014 22:27
add firework links to old gerrit ui
calls = Hash.new(0)
stack = []
trace_file = ARGV[0]
times = Hash.new([])
positions = Hash.new([])
lines = []
File.open(trace_file, 'r') {|f|
lines = f.readlines
}
rb = "["
@JoelHough
JoelHough / ugly_style_regex.md
Created February 12, 2014 18:29
ugly but faster regex

with the (probably useless) \w-\w clause removed, making the regex: /\A([-:,\;#%.\(\)\/\sa-zA-Z0-9!]|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*\z/

>> Benchmark.measure{ Sanitize.clean(<<TEXT, WikiPage.fully_sanitize_fields_config[:body]) }
 | <span lang="EN" style="font-family: 'Times New Roman','serif'; color: #17375e; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-themecolor: text2; mso-themeshade: 191; mso-style-textfill-fill-color: #17375E; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-alpha: 100.0%; mso-ansi-language: EN; mso-style-textfill-fill-colortransforms: lumm=75000"><p></p></span>
 | TEXT
=>   0.000000   0.000000   0.000000 (  0.003236)
# -*- coding: utf-8 -*-
require 'continuation'
def with_caller_binding
cc = nil
count = 0
set_trace_func lambda { |event, file, lineno, id, binding, klass|
if count == 2
set_trace_func nil
cc.call yield(binding)