Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Setup iptables and save them
iptables --flush
iptables --flush -t nat
# Forward all ports to openvpn server
iptables -t nat -A PREROUTING -d {{ public_openvpn_ip }} -p udp --match multiport --dport 2:1193 -j DNAT --to-destination :1194
iptables -t nat -A PREROUTING -d {{ public_openvpn_ip }} -p udp --match multiport --dport 1195:65535 -j DNAT --to-destination :1194
class CreatedAtMixin(object):
"""Adds a read-only column created_at to a table
An sqlalchemy.exc.ArgumentError will be raised it someone is trying to set
created_at. However, the '_created' column can still be set.
"""
_created = Column('created_at', DateTime,
server_default=text('NOW()'), nullable=False)
"""
Auth views
~~~~~~~~~~
"""
import functools
from pyramid.security import (
remember,
forget,
import copy
import functools
import json
from pyramid.httpexceptions import (
HTTPUnsupportedMediaType,
)
from colander import (
Invalid,
)
from colander import (
MappingSchema,
SchemaNode,
String,
)
class Login(MappingSchema):
username = SchemaNode(String())
"""
Auth database models
~~~~~~~~~~~~~~~~~~~~
"""
from pyramid.security import (
Allow,
Authenticated,
"""
AuthUser views
~~~~~~~~~~~~~~
"""
from pluto.views import (
InvalidDataError,
client_data_schema,
~/Projects/monday-100gb:/ vagrant ssh -c 'ls -l' 100gb
total 0
Connection to 127.0.0.1 closed.
import os
import csv
original_dir = 'first'
new_dir = 'other'
output_dir = 'output'
for (root, dirs, files) in os.walk(original_dir):
for filename in files:
relpath = os.path.join(root, filename)