Skip to content

Instantly share code, notes, and snippets.

View thehenster's full-sized avatar

Henry thehenster

  • https://char.gy
  • London
View GitHub Profile
@thehenster
thehenster / gist:7861351
Created December 8, 2013 18:08
An example of the proof of work concept in Bitcoin.
package main
import (
"fmt"
"strconv"
"crypto/sha256"
"encoding/base64"
)
func main(){
# As root user
sudo su
# Update the OS
apt-get update -y
# Setup Hostname & TimeZone
echo "{{HOSTNAME}}" > /etc/hostname
hostname -F /etc/hostname
@thehenster
thehenster / to_string
Created October 26, 2012 09:08
to_string
########
# Author: Henry Turner
# Project: to_string
# Description: A speedy algorithm to convert a string to a string
# License: MIT
########
def to_string
# process the string
 self.to_s
end
@thehenster
thehenster / gist:2215231
Created March 27, 2012 11:44
How to remove/disable the automatic XSS protection helper html escaping for Rails 3
# dirty way to completely remove the automatic escaping of html in rails helpers
# useful to get your Rails 2 -> 3 upgrade running to the point where the raw/.html_safe additions can be delegated
module CustomHtmlSafe
def html_safe?
true
end
end
class ActionView::OutputBuffer