This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DrawInfo* info = malloc(sizeof(*info)); | |
GetDrawInfo(NULL, info); | |
DestroyDrawInfo(info); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gcc -I/ec/include/ImageMagick-6/ -L/ec/lib -lMagickCore-6.Q16 ./magick.c | |
$ UMEM_DEBUG=default,audit,verbose ./a.out | |
umem allocator: redzone violation: write past end of buffer | |
buffer=8103bc0 bufctl=8106a58 cache: umem_alloc_640 | |
previous transaction on buffer 8103bc0: | |
thread=1 time=T-0.000636133 slab=8105f98 cache: umem_alloc_640 | |
libumem.so.1'umem_cache_alloc_debug+0x1fe | |
libumem.so.1'umem_cache_alloc+0x18f | |
libumem.so.1'umem_alloc+0x50 | |
libumem.so.1'malloc+0x36 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(int argc, char * argv[]) | |
{ | |
DrawInfo* info = AcquireMagickMemory(sizeof(*info)); | |
GetDrawInfo(NULL, info); | |
DestroyDrawInfo(info); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stuff with obvious replacements: | |
image_science, rmagick => mini_magick (not a drop-in replacement) | |
mysql2 => activerecord-jdbc-adapter, jdbc-mysql | |
unicorn => puma | |
# Stuff that we only use because they're optimized: | |
hiredis | |
yajl-ruby => json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require('bluebird') | |
var a = Promise.reject(new Error('load failed')).delay(100) | |
var b = Promise.resolve(123).delay(50) | |
var queue = [a,b] | |
function processQueue() { | |
var next = queue.shift() | |
if (next) { | |
return next.catch(processQueue) | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function secondsToHoursMinutesSeconds(totalSec) { | |
totalSec = Math.round(totalSec) | |
var hours = Math.floor(totalSec / 3600) % 24 | |
totalSec -= hours * 3600 | |
var minutes = Math.floor(totalSec / 60) % 60 | |
totalSec -= minutes * 60 | |
return padToTwo(hours) + ':' + padToTwo(minutes) + ':' + padToTwo(totalSec) | |
} | |
// 3000 -> "50:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe '#instances' do | |
it 'should return all instances of a class currently present in the Ruby ObjectSpace' do | |
klass = Class.new | |
some_instances = [klass.new, klass.new, klass.new] | |
some_instances.each {|instance| klass.instances.should include(instance) } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ------------------------------------------------------------------------ | |
# colorwrap | |
# | |
# This script wraps a command in a different background and foreground | |
# color. Depending on what the command is, it sets the color, runs the | |
# command, then sets the color back to what it was before | |
# | |
# To display the current colors being used: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precmd() { | |
local branch_ref branchless_ref | |
psvar=() | |
branch_ref=$(git symbolic-ref -q HEAD 2>/dev/null) | |
cleanliness="" | |
if [[ ! -z $(git diff-index --name-only HEAD 2>/dev/null) ]]; then | |
cleanliness="*" | |
fi | |
# We might be on a checked out branch: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"status":"200 OK", | |
"code":"/api/status/ok", | |
"qname":{ | |
"code":"/api/status/error", | |
"messages":[ | |
{ | |
"info":{ | |
"count":2, | |
"result":[ |