Skip to content

Instantly share code, notes, and snippets.

View tuannvm's full-sized avatar
:octocat:
Focusing

Tommy Nguyen tuannvm

:octocat:
Focusing
View GitHub Profile
# Standard library imports...
from unittest.mock import Mock, patch
# Third-party imports...
from nose.tools import assert_is_not_none
# Local imports...
from project.services import get_todos
"finn.yml"
################
---
- hosts: web
vars:
user: "finn"
public_key: "{{ lookup('file', 'finn.pub') }}"
deleted_user: "chip"
deleted_public_key: "{{ lookup('file', 'chip.pub') }}"
class Store:
def __init__(self, name):
self.name = name
self.items = []
def add_item(self, name, price):
self.items.append({
'name': name,
'price': price
})
class Student():
def __init__(self, name, school):
self.name = name
self.school = school
self.mark = []
def average(self):
return sum(self.mark) / len(self.mark)
def friend(self, friend_name):
@tuannvm
tuannvm / error.txt
Last active January 17, 2017 05:48
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1994, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python2.7/site-packages/flask_restful/__init__.py", line 271, in error_router
return original_handler(e)
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/site-packages/flask_restful/__init__.py", line 268, in error_router

GLaCOS (Genetic Lifeform and Cloud Operating System), your AI research assistant, had nothing to do lately, so you decided to create a little game for him to keep him entertained. You downloaded the cloud GLaCOS operates and stored it under the /root/devops/cloud directory. Here are the rules of the game you came up with.

There are a bunch of folders and files under the root/devops/cloud directory. The are two types of files in the system:

A hint. Each hint file starts with a line containing a single "Hint" word (without quotes or leading/trailing whitespace characters). The second line contains a sequence (possibly empty) of words "up" and "down", separated by a single whitespace character. Not a hint. It is guaranteed that the first line of the such a file is not "Hint". The goal of the game is to find a secret folder. It is known that there is a sequence of hints that leads to it, and that the first hint is called start.hint and is located in root/devops/cloud. Here's how to win the game starting with th

#!/bin/bash
python << END
# 1. read start.hint, filter out the instructions (OK)
# copy them to list or dict (OK)
# check whether file or directory?
# if dir, then loop through the list and execute the correlative instruction
# end of list, looking for new unique hint file
import os
@tuannvm
tuannvm / vultr-coreos-bootstrap.sh
Created March 24, 2017 09:19 — forked from janeczku/vultr-coreos-bootstrap.sh
Cloud-config for CoreOS IPXE deployment on Vultr. Provisioning etcd, fleet, private network and docker compatible firewall.
#!/bin/bash
# Cloud-config for CoreOS IPXE deployment on Vultr
##################################################
# This cloud-config bootstraps CoreOS on /dev/vda and provisions:
# - private ip-address on eth1
# - etcd on private network
# - fleet on private network
# - basic firewall (docker compatible)
# - SSHd security hardening
##################################################
@tuannvm
tuannvm / easy-k8s-coreos.md
Created March 24, 2017 09:48 — forked from soellman/easy-k8s-coreos.md
Easy Kubernetes on CoreOS

Easy Kubernetes Installation on CoreOS

At Timeline Labs, we are continuously looking at new technologies to see what fits our needs. We are especially excited about Kubernetes from Google to manage our services atop Docker and CoreOS.

This process for installing Kubernetes on CoreOS uses Flannel for Kubernetes networking and should be cloud provider agnostic. To deploy the Kubernetes master functionality into the cluster, it uses fleetctl.

Thanks to Kelsey Hightower and his blog posts! They served as a great starting point for this process.

How do I get this running?

Add the cloud config below to your own and bring up your cluster using a CoreOS version with Docker 1.3 (currently v472.0.0 in alpha). During that initial boot, the download-kubernetes and download-flannel units will download binaries from the latest project release and use those.