Skip to content

Instantly share code, notes, and snippets.

@dce
dce / sunspot.rb
Created November 20, 2018 20:53
Sunspot/RSpec configuration (borrows heavily from https://dzone.com/articles/install-and-test-solrsunspot)
require 'sunspot/rails/spec_helper'
require 'net/http'
try_server = proc do |uri|
begin
response = Net::HTTP.get_response uri
response.code != "503"
rescue Errno::ECONNREFUSED
end
end

Keybase proof

I hereby claim:

  • I am dce on github.
  • I am dce (https://keybase.io/dce) on keybase.
  • I have a public key whose fingerprint is 7884 224B E2F6 0E0F 1CE4 B34B 9FDB 12C7 D60E 357A

To claim this, I am signing this object:

package main
import (
"fmt"
)
func make_addr(y int) (func(int) int) {
return func(x int) (int) {
return x + y
}
@dce
dce / decrypt.sh
Created August 29, 2013 13:43
encrypt.sh sensitive_information.txt "the crow flies at midnight"
#!/bin/sh
openssl aes-256-cbc -d -a -pass "pass:$2" -in $1 -out `echo $1 | sed 's/\.enc$//'`
@dce
dce / decrypt.sh
Created June 14, 2013 15:26
Encrypt/decrypt a file
#!/bin/sh
openssl aes-256-cbc -d -a -pass "pass:$2" -in $1 -out `echo $1 | sed 's/\.enc$//'`
require "test/unit"
def balanced?(string)
# ...
end
def count_change(money, coins)
# ...
end
@dce
dce / string_add.c
Last active December 15, 2015 15:49
Add two strings of integers
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#define CTOI(c) c - '0'
#define ITOC(i) '0' + i
char *
add(char *n1, char *n2)
@dce
dce / Makefile
Created April 1, 2013 11:55
Experimenting with Rope (https://github.com/josephg/librope)
CFLAGS = -g -Wall -Wextra
all:
make rope
gcc -o main main.c rope.o
rope:
gcc -o rope.o -c rope.c
clean:
@dce
dce / Makefile
Created March 18, 2013 13:10
Simple C dynamic array library w/ radix sort implementation.
CFLAGS=-g -Wall -Wextra
all: dynamic_array
clean:
rm -rf dynamic_array *.dSYM
@dce
dce / .gitignore
Last active December 13, 2015 23:09 — forked from reagent/.gitignore
main
*.dSYM