This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
""" | |
A really stupid python template language inspired by coffeekup, markaby. | |
Do not use this code, it will ruin your day. A byproduct of insomnia. | |
TL;DR | |
----- | |
This module defines a template language that allows us to do: | |
d = Doc() |
<a href="" class="button_holder"> | |
<span class="f1"> | |
<span class="f2"> | |
<span class="f3"> | |
<img src="http://picbox.im/image/7f1b604490-off.png"> | |
</span> | |
</span> | |
</span> | |
</a> |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This gist is a fork of the gist from this blog post.
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */ | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <limits.h> | |
#include <string.h> | |
struct entry_s { | |
char *key; | |
char *value; |
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
#!/bin/bash | |
# Description: | |
# Nginx configurations | |
# Execution: | |
# First a lot the correct file permissions for the setup file: | |
# $ chmod 755 setup.sh | |
# And then simply run |
#!/bin/bash | |
# Description: | |
# EC2 setup. | |
# Based on Ubuntu, debian based systems | |
# Execution: | |
# First a lot the correct file permissions for the setup file: | |
# $ chmod 755 setup.sh |
from collections import deque | |
from sys import maxint as MAXINT | |
# Breadth first search | |
def bfs(graph, start): | |
explored, queue = set([start]), deque([start]) | |
while len(queue): | |
vertex = queue.popleft() | |
yield vertex | |
for neighbor in graph[vertex]: |