Skip to content

Instantly share code, notes, and snippets.

"""
Auth views
~~~~~~~~~~
"""
import functools
from pyramid.security import (
remember,
forget,
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)
#!/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
<?php
[
'price' => [
'retail' =>
[
'USD' => [
'type' => 'retail',
'currency' => 'USD',
'value' => 10,
create table made_export (
id int primary key,
type varchar(80) not null,
);
create table made_order_export (
id int primary key references made_export.id,
order_id int references order.id,
);
class NavisionSoapClient extends ExportClient {
}
class NavisionOrderFormatter extends ModelFormatter {
}
class NavisionOrderExportAdapter extends ExportAdapter {
}
abstract class ExportMessage {
function __construct($type, $params) {
$this->_type = $type;
$this->_params = $params;
}
function getType() {
return $this->_type;
}
<?php
interface ExportLogger {
function info();
function debug();
function warning();
function error();
function fatal();
}
{% with object.get_main_image_or_none as img %}
{% if img %}
<div class="img">
<a href="{% url 'view_object' object.gid %}"><img src="{{ img.image_thumbnail.url }}"></a>
</div>
{% endif %}
{% endwith %}
node default {
Exec { path => "/bin:/usr/bin:/usr/local/bin" }
exec { "apt-get update": command => "apt-get update" }
package {'vim': ensure=>installed, }
#class { 'postgresql::server': } postgresql::server::db {'pluto_development': user => 'pluto', password => postgresql_password('pluto', 'plutopass'),}