Skip to content

Instantly share code, notes, and snippets.

View marklap's full-sized avatar

Mark LaPerriere marklap

View GitHub Profile
@marklap
marklap / test.go
Created May 1, 2014 15:03
Just toying around with Go
package main
import (
"fmt"
"math"
)
const POUNDS_IN_GRAM float64 = 0.00220462
const OUNCES_IN_GRAM float64 = 16.0
@marklap
marklap / jobs.go
Created May 14, 2014 21:38
Tinkering with creating structs, interfaces for Jobs, Tasks, Executions, etc
package main
import (
"fmt"
"time"
"github.com/twinj/uuid"
)
const (
@marklap
marklap / simple_state_machine.py
Last active August 29, 2015 14:01
A simple example of a state machine
from __future__ import print_function
import sys
from collections import namedtuple
from pprint import pprint
STATE_CONST = (
'STOPPED',
'STARTING',
'RUNNING',
'STOPPING',
@marklap
marklap / pig_latin.go
Last active August 29, 2015 14:01
pig latin
package main
import "fmt"
import "strings"
import "unicode"
var msg_orig = "Hello World! This is the best ever"
var vowels = "aeiou"
func main() {
@marklap
marklap / try_test.go
Last active August 29, 2015 14:01
Messing around with unit testing in Go
package main
import "testing"
func TestMain(t *testing.T) {
something := -1
if testing.Short() {
t.Skip("Skipping this stupid test")
}
@marklap
marklap / throttle_decorator.py
Last active August 29, 2015 14:15
Throttles a function for N number of seconds between calls
################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2015 Mark LaPerriere
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@marklap
marklap / now_datetime_with_tz.py
Created February 9, 2015 20:47
Get `now` datetime with current timezone
now = datetime.utcnow().replace(tzinfo=timezone.utc).astimezone(tz=None)
################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2015 Mark LaPerriere
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@marklap
marklap / page_iterator.py
Created March 5, 2015 16:44
Generic python class for iterating over paged results (typically seen in REST APIs)
import os
import sys
# TODO: make it work
@marklap
marklap / Zombie.java
Last active August 29, 2015 14:21
Java Zombie
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Mark LaPerriere
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is