Skip to content

Instantly share code, notes, and snippets.

<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='100' height='50' %3E%3Ctext font-size='16' x='10' y='20'%3E%3Ctspan fill='red'%3EHello%3C/tspan%3E, %3Ctspan fill='green'%3Eworld%3C/tspan%3E! %3C/text%3E%3C/svg%3E"/>

@benmanns
benmanns / ci-key-recover.py
Created February 21, 2016 12:35 — forked from kivikakk/ci-key-recover.py
recover key from CodeIgniter homegrown crypto
#!/usr/bin/env python3
# CodeIgniter pre-2.2 non-mcrypt Encrypt reverser.
# Finds the key by partially-known plaintext attack.
# Written by Yuki Izumi. Placed in the public domain.
import codecs
import re
import sys
import time
@benmanns
benmanns / gist:5912126
Last active December 19, 2015 06:29 — forked from mguterl/gist:308216
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by jay@gooby.org http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
@benmanns
benmanns / index.html
Created November 3, 2012 14:06 — forked from mbostock/.block
Spermatozoa
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.1"></script>
<style type="text/css">
body {
background: #000;
}
@benmanns
benmanns / chef_solo_bootstrap.sh
Created October 28, 2012 14:29 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p286.tar.gz
tar -xvzf ruby-1.9.3-p286.tar.gz
cd ruby-1.9.3-p286/
./configure --prefix=/usr/local
make
make install
@benmanns
benmanns / config-s3.yml
Created December 7, 2011 20:15
rake task to migrate paperclip attachments to Amazon S3
# Required:
access_key_id:
secret_access_key:
bucket_name:
# Optional:
server: s3.amazonaws.com
port: 80
use_ssl: false
persistent: false
@benmanns
benmanns / gist:1267915
Created October 6, 2011 16:49 — forked from andrewpthorp/gist:1267848
Preference for helper specs?
# Option 1:
# Use content to separate the helper from the spec
it "should have something" do
content = helper.some_helper_method
content.should have_tag('a', :text => 'foo')
end
# Option 2:
# Combine helper call and spec
require 'benchmark'
def benchmark(setting, &block)
data = (1..10_000_000).map { block.call }
Benchmark.bm(15) do |x|
x.report("compact #{setting}") do
data.dup.each do |d|
[d[0],d[1]].compact.min
end
<!-- code to show my post -->
<% form_for [@post, Comment.new] do |f| %>
Body: <%= f.text_field :body %>
<p><%= f.submit "Add Comment" %></p>
<% end %>