Skip to content

Instantly share code, notes, and snippets.

@Tefnet
Tefnet / sqla_ca.py
Created September 20, 2012 17:36
How to avoid monkey-patching sqlalchemy.ext.declarative.api._as_declarative
import sqlalchemy as sa
import sqlalchemy.ext.declarative
"""
How to avoid monkey-patching sqlalchemy.ext.declarative.api._as_declarative???
"""
USE_EVENT=True
if USE_EVENT:
@Tefnet
Tefnet / GtkLabel_shadow.c
Created December 12, 2012 19:20
Shadow for GtkLabel
static gboolean label_exposed(GtkWidget *widget, GdkEventExpose *event, gpointer userdata)
{
double width = 4.0;
int offset_x = 2;
int offset_y = 2;
cairo_t *cr = gdk_cairo_create(widget->window);
gint x = widget->allocation.x;
gint y = widget->allocation.y;
PangoLayout *layout = gtk_label_get_layout(GTK_LABEL(widget));
@Tefnet
Tefnet / gist:4390089
Created December 27, 2012 17:24
SQLAlchemy DeclarativeMeta example
import sqlalchemy
import sqlalchemy.orm
import sqlalchemy.ext.declarative
class BaseClsMeta(sqlalchemy.ext.declarative.DeclarativeMeta):
def __init__(cls, classname, bases, dict_):
if getattr(cls, '__dupa__', False):
for i in range(10):
fname = 'fid%d' % i
dict_[fname] = sqlalchemy.Column(fname, sqlalchemy.types.Integer())
from eve import Eve
from eve.io.sqlalchemy import SQLAlchemy
app = Eve(data=SQLAlchemy)
db = app.data.driver
test_data = [
(u'George', u'Washington'),
from eve import Eve
from eve.io.sqlalchemy import SQLAlchemy, Validator
import models
app = Eve(validator=Validator, data=SQLAlchemy)
db = app.data.driver
db.create_all()
if not db.session.query(models.People).count():
for item in models.test_data:
#!/bin/bash
#
# pgpool-II replication manager
#
# Interfaces with pgpool's pcp command-line tools to provide access to common functions for managing
# load-balancing and failover.
#
# dsimmons@squiz.co.uk
# 2011-08-28
@Tefnet
Tefnet / 0_reuse_code.js
Last active August 29, 2015 14:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Tefnet
Tefnet / mail-setup.sh
Last active September 2, 2021 12:49 — forked from trungpv93/mail-setup.sh
Install Postfix, Dovecot, RoundCube on Ubuntu 16.04
#!/usr/bin/env bash
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
DOMAIN="xxx.vn"
PASS_DB_ROUNDCUBE="xxx"
@Tefnet
Tefnet / install_ffmpeg_ubuntu.sh
Created September 19, 2017 19:45 — forked from seankross/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update

Keybase proof

I hereby claim:

  • I am tefnet on github.
  • I am jezier (https://keybase.io/jezier) on keybase.
  • I have a public key ASB6Yi_U4Om5zX61O12YG1x7lYorxA1Cq1mrZp5VCzqmnwo

To claim this, I am signing this object: