Skip to content

Instantly share code, notes, and snippets.

@BlackPie
BlackPie / template.html
Created June 28, 2016 09:23 — forked from imkevinxu/template.html
Django code to read uploaded CSV file
<form action="{% url %}" method="post" enctype="multipart/form-data">{% csrf_token %}
<input type="file" name="csv_file" />
<input type="submit" value="Upload" />
</form>
@drmalex07
drmalex07 / README-reverse-proxy-in-haproxy.md
Last active February 7, 2023 14:55
Perform simple reverse-proxying in HAProxy. #reverse-proxy #proxy #haproxy #proxypass

A more complete example (with rewriting cookie domains/paths) can be found at http://blog.haproxy.com/2014/04/28/howto-write-apache-proxypass-rules-in-haproxy/

We will try something roughly equivalent to the following ProxyPass directives in Apache2:

ServerName www.example.com
...
ProxyPass        /foo/  http://foo.local
ProxyPassReverse /foo/  http://foo.local

In haproxy.cfg we define a backend, say foo, to reverse-proxy to foo.local backend server.

@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active May 9, 2024 03:03
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@Lurunchik
Lurunchik / gist:11256656
Last active August 29, 2015 14:00
PostgreSQL: Partition with returning <column> solved "0 rows problem"
--partitioning like http://www.postgresql.org/docs/9.3/static/ddl-partitioning.html
--create master table
CREATE TABLE master_table
(
id serial,
key character varying NOT NULL,
value character varying NOT NULL,
CONSTRAINT master_table_pkey PRIMARY KEY (id)
);
--create slave tables with constraint
@d3noob
d3noob / .block
Last active July 11, 2023 19:59
Simple vertical d3.js tree diagram
license: mit
@robulouski
robulouski / gmail_imap_example.py
Last active April 19, 2024 02:27
Very basic example of using Python and IMAP to iterate over emails in a gmail folder/label. http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
#!/usr/bin/env python
#
# Very basic example of using Python and IMAP to iterate over emails in a
# gmail folder/label. This code is released into the public domain.
#
# RKI July 2013
# http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
#
import sys
import imaplib
@guillaumepiot
guillaumepiot / gist:5583149
Created May 15, 2013 10:54
DJANGO - Admin custom list filter
class CategoryListFilter(SimpleListFilter):
# USAGE
# In your admin class, pass trhe filter class as tuple for the list_filter attribute:
#
# list_filter = (CategoryListFilter,)
# Human-readable title which will be displayed in the
# right admin sidebar just above the filter options.
@dcramer
dcramer / args.py
Last active June 1, 2021 14:28
Python Standards (that I would change and enforce if I could)
# dont do this
this_function_name(foo, bar
baz)
# do this
cramers_version(
foo, bar, baz)
# allow this
cramers_version(foo, bar,
@imkevinxu
imkevinxu / template.html
Created August 16, 2012 02:11
Django code to read uploaded CSV file
<form action="{% url %}" method="post" enctype="multipart/form-data">{% csrf_token %}
<input type="file" name="csv_file" />
<input type="submit" value="Upload" />
</form>