Skip to content

Instantly share code, notes, and snippets.

@gene9
gene9 / InheritGenericClass.cs
Created April 27, 2016 13:17 — forked from TryJSIL/InheritGenericClass.cs
Generic Inheritance
using System;
public class GenericClass<T> {
public virtual void Method (T value) {
Console.WriteLine("GenericClass<{0}>.Method({1})", typeof(T), value);
}
}
public class MyClass<T> : GenericClass<T> {
public override void Method (T value) {
@gene9
gene9 / getopt.c
Created October 22, 2015 18:43 — forked from ashelly/getopt.c
"Port of GNU getopt() to Win32 for anyone who's tired of dealing with getopt() calls in Unix-to-Windows ports." Ported by Pete Wilson. Recovered from the Internet Archive's snapshot of www.pwilson.net/sample.html.
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
#!/usr/bin/env python3
"""Notes on `arrow` library.
* inconsitent (fixed)
>>> a = arrow.get(datetime(2012, 4, 7, 0, 30, 00), 'America/New_York')
>>> a.datetime.tzname() == a.tzinfo.tzname(a.datetime) # fixed
True

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
namespace MyProject
{
[TestFixture]
# In myapp.tasks __init__.py
from celery import Celery
celery = Celery()
Task = celery.create_task_cls()
class MyBaseTask(Task):
abstract = True
# ...

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors

#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'

Hey! I saw this has been indexed by the search engines. It is a first draft of a post I ended up publishing on my blog at: Scaling PostgreSQL With Pgpool and PgBouncer

Thanks for stopping by!

PostgreSQL and Pgpool Architecture

@gene9
gene9 / forms.html
Last active August 29, 2015 14:06 — forked from gnunicorn/forms.html
{%- macro form_field_label(field) -%}
<label for="{{ field.id }}">{{ field.label.text }}
{%- if field.flags.required -%}
<abbr title="Diese Feld muss angegeben werden">*</abbr>
{%- endif %}</label>
{% endmacro %}
{%- macro form_field_description(field) -%}
{% if field.description %}
<span class="descr">{{ field.description }}</span>