I hereby claim:
- I am nathany on github.
- I am nathany (https://keybase.io/nathany) on keybase.
- I have a public key ASDQMnXaH02CR8BQhuy4A0xJpt8RfQDOIkGAJFX9QuNlIAo
To claim this, I am signing this object:
# I forgot the firmware password on my MacBook Air and didn't want to take it in: | |
# http://support.apple.com/kb/TS2391 | |
# info | |
# http://paulmakowski.blogspot.com/2009/03/apple-efi-firmware-passwords.html | |
# run the following command to retrieve your obfuscated firmware password: | |
# sudo nvram -p | grep security-password | |
security_password = "%..." | |
# take the complement of every second bit: |
-- Trigger to maintain a log of changes to the Users table (T-SQL, SQL Server 2005) | |
-- Presently only tracking UPDATEs | |
-- Inspiration from: http://goo.gl/Geds | |
IF OBJECT_ID('tr_ChangeLogOnUsers', 'TR') IS NOT NULL | |
DROP TRIGGER tr_ChangeLogOnUsers; | |
GO | |
CREATE TRIGGER tr_ChangeLogOnUsers ON Users FOR UPDATE | |
AS | |
-- only when LastModifiedBy is changed (someone made a change vs. something) |
# add something like this to config.ru | |
# see https://github.com/kzk/unicorn-worker-killer | |
if Integer(ENV['UNICORN_KILLER'] || 0) != 0 | |
require 'unicorn/worker_killer' | |
# Max memory size (RSS) per worker | |
use Unicorn::WorkerKiller::Oom, (350*(1024**2)), (400*(1024**2)), 30, true | |
end |
// Returns the index of the first character contained in searchChars | |
// From Apache Commons Lang, http://commons.apache.org/lang/ | |
public static int indexOfAny(String str, char[] searchChars) { | |
if (isEmpty(str) || ArrayUtils.isEmpty(searchChars)) { | |
return -1; | |
} | |
for (int i = 0; i < str.length(); i++) { | |
char ch = str.charAt(i); | |
for (int j = 0; j < searchChars.length; j++) { | |
if (searchChars[j] == ch) { |
I hereby claim:
To claim this, I am signing this object:
defmodule Luhn do | |
@moduledoc """ | |
Luhn algorithm to checksum credit cards. | |
""" | |
@doc """ | |
Check if a credit card number is valid based on luhn. | |
""" | |
def valid?(cc) when is_integer(cc) do | |
Integer.digits(cc) |
* mixins (include and extend) for simple modularization (vs. multiple inheritance or traits in other languages) | |
* innovations in the web space (haml, rack middleware, etc.) | |
* standardized around MIT and GIT | |
* no public properties (attr_accessor, etc.) | |
* open classes | |
* tooling (gem, rake) | |
* animal references (ducks, monkeys, bacon) | |
* metaprogramming (unicorns) | |
* TDD/BDD emphasis and tools |
// copyAndChecksum calculates a checksum while writing to another output | |
func copyAndChecksum(w io.Writer, r io.Reader) (string, error) { | |
h := md5.New() | |
mw := io.MultiWriter(w, h) | |
if _, err := io.Copy(mw, r); err != nil { | |
return "", err | |
} | |
return hex.EncodeToString(h.Sum(nil)), nil | |
} |
<cfscript> | |
function ListSplit(list, chunk_size, delim) | |
{ | |
var result = ArrayNew(1); var re = ""; var start = 1; | |
while(1) { | |
re = REFind("((?:[^#delim#]+#delim#){1,#chunk_size#})", list & delim, start, "true"); | |
if( re.len[1] eq 0 ) break; | |
ArrayAppend(result, Mid(list,re.pos[1],re.len[1]-len(delim))); | |
start = re.pos[1] + re.len[1]; | |
if(start gte len(list)) break; |
package main | |
import ( | |
"os" | |
"testing" | |
) | |
func TestGetSHA(t *testing.T) { | |
sha, err := getSHA1() | |
if err != nil { |