Skip to content

Instantly share code, notes, and snippets.

%lex
%%
\<[a-zA-Z][a-zA-Z0-9_-]+\> return 'IDENT'
\'[^']*\' return 'LITERAL'
\"[^"]*\" return 'LITERAL'
\s+ /* ignore whitespace */
<<EOF>> return 'EOF'
$ return 'EOL'
@makyo
makyo / error.txt
Created December 4, 2016 18:47
Go panic on git crash
$ git status
failed MSpanList_Insert 0x765888 0x1756382d6b3e0 0x0
fatal error: MSpanList_Insert
runtime stack:
runtime.MSpanList_Insert(0x6a2298, 0x765888)
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/mheap.c:692 +0x8f
runtime.MHeap_Alloc(0x69fe00, 0x1, 0x1000000001f, 0xcf29)
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/mheap.c:240 +0x66
runtime.MCentral_CacheSpan(0x6a8a18, 0x7657b8)
@makyo
makyo / ex.py
Last active April 12, 2016 20:50
game_running = True
have_knife = False
while game_running:
print "you are in a dark cave\n"
cmd = raw_input("> ")
if cmd == "east":
print "You are in a cave; you find a knife\n"
@makyo
makyo / 3.hs
Last active February 19, 2016 00:18
factors :: Int -> [Int]
factors n =
filter (\ x -> n `mod` x == 0) [2, 3 .. ceiling (sqrt (fromIntegral n))]
isPrime :: Int -> Bool
isPrime n =
factors n == []
-- Naive
largestPrimeFactor :: Int -> Int
@makyo
makyo / bundles.md
Last active August 29, 2015 14:27
Bundles blog post

Bundles Bundles Bundles!

You’ve gone through the process of sorting through various service orchestration solutions, and settled on Juju, since it will work with your existing frameworks and solutions, such as chef, puppet, and ansible. You’ve gone ahead and charmed up a few of your microservices so that you can get them deployed to your Juju environment. You’ve searched through the charmstore to find the databases, load balancers, and additional charms that you need to really make your project shine.

Whew! That’s gonna be a lot of docs to write for new hires, right?

Not necessarily! Here’s where bundles come into play!

Bundles allow you to pull all of your services, unit placements, and relations together into one YAML file. A bundle is basically an export of a Juju environment. In fact, if you use the Juju GUI, it literally is that: the GUI will export all of your services with all of their config values, all of the relations linking them together, and the way your units are placed on machines.

{
"RequestId":5,
"Response":{
"Deltas":[
[
"machine",
"change",
{
"Id":"0",
"InstanceId":"localhost",
{
"RequestId":5,
"Response":{
"Deltas":[
[
"machine",
"change",
{
"Id":"0",
"InstanceId":"localhost",
series: trusty
services:
mediawiki:
charm: "cs:trusty/mediawiki-3"
num_units: 1
annotations:
"gui-x": "15"
"gui-y": "61"
to:
- "lxc:1"
series: trusty
services:
mysql:
charm: "cs:trusty/mysql-25"
num_units: 1
annotations:
"gui-x": "-284"
"gui-y": "-78"
to:
- "lxc:0"
series: precise
services:
mysql:
charm: "cs:precise/mysql-51"
num_units: 1
annotations:
"gui-x": "87"
"gui-y": "39"
to:
- "1"