Skip to content

Instantly share code, notes, and snippets.

uint w = m_image.width();
uint h = m_image.height();
uint m = m_image.size();
const Scalar de = 1.0/gamma;
const Scalar dc = -4.0/gamma + 1.0;
printf("w h %i %i\n", w, h);
using Matrix = Eigen::SparseMatrix<Scalar>;
Matrix A(m, m);
Eigen::VectorXd b(m);
float radicalInverse_VdC(uint bits) {
bits = (bits << 16u) | (bits >> 16u);
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
}
vec2 Hammersley(uint i, uint N) {
@krisr
krisr / gist:884124
Created March 23, 2011 22:02
git branches - lists local and remote branches sorted by date
#!/usr/bin/env bash
#
# Prints local branches and remote branches prefixed with your git email
# username sorted by date.
set -o errexit
set -o nounset
USER_NAME=`git config user.email | sed s:\@.*::`
TAN="\033[33m"
NO_COLOR="\033[0m"
set[:foo] = [{},{}]
foo.each do |foo|
foo[:name] = 3
end
#!/bin/bash -xe
# Run this script from machine with the credintials and the latest api tools installed
EBS_DEVICE='/dev/sdh'
INSTANCE_ID=$1
AKI=${2:-'aki-5f15f636'}
ARI=${3:-'ari-0915f660'}
ARCH=${4:-'i386'}
SIZE=${5:-10}
service "apache2" do
action [:stop]
end
service "apache2" do
action [:start]
end
module EventMachine
def self.system3(cmd, *args, &cb)
cb ||= args.pop if args.last.is_a? Proc
init = args.pop if args.last.is_a? Proc
# merge remaining arguments into the command
cmd = ([cmd] + args.map{|a|a.to_s.dump}).join(' ')
new_stderr = $stderr.dup
require 'rubygems'
require 'eventmachine'
$stdout.sync = true
$stderr.sync = true
EM.run {
EM.add_periodic_timer(0.1) {
$stdout.write "stdout\n"
function make_doc_2d() {
defaults write com.apple.dock no-glass -boolean YES
killall Dock
}
function make_doc_3d() {
defaults write com.apple.dock no-glass -boolean NO
killall Dock
}
# Cookbook Name:: s3fs
# Recipe:: default
if ['solo', 'app', 'util', 'app_master'].include?(node[:instance_role])
http_request "reporting for s3fs" do
url node[:reporting_url]
message :message => "configuring s3fs"
action :post
epic_fail true