Skip to content

Instantly share code, notes, and snippets.

View johnclaus's full-sized avatar

John Claus johnclaus

  • The Front Range
View GitHub Profile
-module(codekata2).
-author('John Claus <johnclaus@gmail.com>').
-export([chop/2]).
-import(lists, [member/2]).
-import(utilities, [index_of/3]).
chop(Elem, List) ->
case member(Elem, List) of
true -> index_of(Elem, List, 0);
false -> -1
@johnclaus
johnclaus / utilities.erl
Created January 1, 2010 21:58
Random utility functions
-module(utilities).
-author('John Claus <johnclaus@gmail.com>').
-export([index_of/3]).
% Hacked element index retrieval function which is unavailable in Erlang's stdlib
index_of(_, [], _) -> not_a_member;
index_of(Item, [Item | _], Index) -> Index;
index_of(Item, [_ | T], Index) -> index_of(Item, T, Index + 1).
@johnclaus
johnclaus / hiphop.c
Created April 18, 2011 06:59
Refreshing my memory of C I/O against FB's take on FizzBuzz
// Solution to https://www.facebook.com/careers/puzzles.php?puzzle_id=7
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int x, y;
if (argc == 1) {
printf("Filename argument required\n");
def check_number(num):
return (num % 3 == 0 or num % 5 == 0)
def sum_it(upto):
sum = 0
for i in range(1, upto):
if check_number(i): sum += i
return sum
@johnclaus
johnclaus / gist:1100251
Created July 22, 2011 19:40
Amazon RDS Performance Tuning Settings
rds-modify-db-parameter-group {param-group-name} \
--parameters="name=character_set_server, value=utf8, method=pending-reboot" \
--parameters="name=collation_server, value=utf8_general_ci, method=pending-reboot" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=query_cache_type, value=1, method=pending-reboot" \
--parameters="name=query_cache_size, value={DBInstanceClassMemory/32}, method=pending-reboot" \
--parameters="name=table_open_cache, value=2500, method=pending-reboot" \
--parameters="name=join_buffer_size, value={DBInstanceClassMemory/64}, method=pending-reboot" \
--parameters="name=thread_cache_size, value={DBInstanceClassMemory/12582880}, method=pending-reboot" \
@johnclaus
johnclaus / notsogroovy
Created February 8, 2013 16:16
Groovy bug discovered by a coworker last week.
#!/usr/bin/env groovy
/*
* Simple key/value hash store & retrieve inspired by actual data
*
* $ groovy -v
* Groovy Version: 2.1.0 JVM: 1.7.0_11 Vendor: Oracle Corporation OS: Mac OS X
*/
require 'csv'
require 'zlib'
# Mandatory: Create a single output file containing the date sent, the sender and the subject for each of the messages
class EmailParser
def initialize(filepath)
@filepath = filepath
end
~ ➔ dig www.degoes.net +nostats +nocomments +nocmd
; <<>> DiG 9.8.3-P1 <<>> www.degoes.net +nostats +nocomments +nocmd
;; global options: +cmd
;www.degoes.net. IN A
www.degoes.net. 2332 IN CNAME jdegoes.github.io.
jdegoes.github.io. 2332 IN CNAME github.map.fastly.net.
github.map.fastly.net. 8 IN A 199.27.72.133
~ ➔ dig degoes.net +nostats +nocomments +nocmd
* How do I release this?
* I must be able to perform a 'rolling' release of this in a live system w/o
causing a service interruption
* does it break backward compatability with existing users of the api/system/etc
* do we need to cut a new XSD? A new version (URI prefix) of our API?
* did we make updates to checkouts/SNAPSHOT deps? Do we need to cut new versions of project deps?
* how do I support existing users?
* in what order do the affected systems need to be released?
* are there system or service configuration changes that are required?
* What are the Security implications of my change?

Keybase proof

I hereby claim:

  • I am johnclaus on github.
  • I am john (https://keybase.io/john) on keybase.
  • I have a public key whose fingerprint is 11A0 2463 55E6 3510 CB31 5EF5 50C2 DCDC 5789 D604

To claim this, I am signing this object: