Skip to content

Instantly share code, notes, and snippets.

View sprin's full-sized avatar

Steffen Prince sprin

  • Medellín, Colombia
View GitHub Profile
@sprin
sprin / closures.py
Last active August 29, 2015 14:04
Python "closures"
"""
A little demo of some of the quirks of Python "closures" with inner functions.
Function closures allow a function to access nonlocal variables in the
enclosing scope, even when invoked outside it's immediate lexical scope.
In languages centered around mutable data types, you would expect to be
able to mutate nonlocals in a closure.
MDN has an excellent rundown of closures, with examples in Javascript.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Closures
@sprin
sprin / ansible_module_syntax.yml
Last active August 29, 2015 14:04
ansible module argument syntax?
---
# Do this?
- name: create droplet 512MB/Centos 7/Region NYC2
digital_ocean: >
command=droplet
state=present
name={{ droplet_name }}
client_id={{ client_id }}
api_key={{ api_key }}
size_id=66
@sprin
sprin / Dockerfile
Created August 12, 2014 00:08
Python 2.7.8 on Centos 5
FROM tianon/centos:5.8
RUN yum install -y curl tar gcc make xz
RUN mkdir /usr/src/python
WORKDIR /usr/src/python
RUN curl -Sl "https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz" > Python-2.7.8.tar.xz
RUN xz -dc < Python-2.7.8.tar.xz > Python-2.7.8.tar
RUN tar -xvf Python-2.7.8.tar -C /usr/src/python --strip-components=1
# You may want to verify the download with gpg: https://www.python.org/download
@sprin
sprin / Dockerfile
Created August 12, 2014 00:11
Python 2.7.8 on Centos 5
FROM tianon/centos:5.8
RUN yum install -y curl tar gcc make xz
RUN mkdir /usr/src/python
WORKDIR /usr/src/python
RUN curl -Sl "https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz" > Python-2.7.8.tar.xz
RUN xz -dc < Python-2.7.8.tar.xz > Python-2.7.8.tar
RUN tar -xvf Python-2.7.8.tar -C /usr/src/python --strip-components=1
# You may want to verify the download with gpg: https://www.python.org/download
# Vagrant commands
vagrant reload #!
vagrant status
vagrant suspend
vagrant resume
vagrant halt
vagrant up
vagrant package
vagrant destroy
vagrant box add <nombre> <url>