Skip to content

Instantly share code, notes, and snippets.

View andrebask's full-sized avatar

Andrea Bernardini andrebask

View GitHub Profile
@anjackson
anjackson / gist:2888380
Created June 7, 2012 11:47
Making a Bottle app that routes to a proxy
import bottle
from wsgiproxy.app import WSGIProxyApp
# Remove "hop-by-hop" headers (as defined by RFC2613, Section 13)
# since they are not allowed by the WSGI standard.
FILTER_HEADERS = [
'Connection',
'Keep-Alive',
'Proxy-Authenticate',
'Proxy-Authorization',
@chris-jamieson
chris-jamieson / add-printer.md
Last active February 17, 2021 18:16
Install Epson AL-M1200 printer on Ubuntu

Ubuntu seems to have trouble talking to the Epson AL-M1200 printer. These instructions will get it working. Based on a set of instructions found here.

  1. Download epsoneplijs-0.4.1.tgz -file from here
  2. cd Downloads (or whatever directory you downloaded the file to)
  3. tar zxvf epsoneplijs-0.4.1.tgz
  4. cd epsoneplijs-0.4.1
  5. ./configure --prefix=/usr
  6. sudo make install
  7. Download PPD file from here or here
  8. Connect your printer to your computer and turn it on. (You can do it in the beginning, but at least now you need it connected and powered on.)
@chaitanyagupta
chaitanyagupta / _reader-macros.md
Last active May 19, 2024 19:25
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@silverhammermba
silverhammermba / PKGBUILD
Created May 30, 2014 22:40
Synaptics Palm Detection patch
# $Id: PKGBUILD 213056 2014-05-18 13:44:18Z andyrtr $
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Thomas Bächler <thomas@archlinux.org>
# Contributor: Alexander Baldeck <alexander@archlinux.org>
pkgname=xf86-input-synaptics
pkgver=1.8.0
pkgrel=2
pkgdesc="Synaptics driver for notebook touchpads"
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing
@yang-wei
yang-wei / destructuring.md
Last active July 4, 2024 16:56
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@tfentonz
tfentonz / describe-rules.md
Last active June 13, 2023 10:44
AWS CLI command to list ELB listener rule priorities

Get load balancer ARN

arn=$(aws elbv2 describe-load-balancers --names <value> --query 'LoadBalancers[].[LoadBalancerArn]' --output text)

Get listeners

aws elbv2 describe-listeners --load-balancer-arn "$arn" --query 'Listeners[].{ListenerArn:ListenerArn,Protocol:Protocol,Port:Port}'

[
@johnhw
johnhw / umap_sparse.py
Last active January 6, 2024 16:09
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random

The Cabal/Stack Disambiguation Guide

One of the most frequently asked Haskell beginner questions in recent years is:

"Stack or cabal?"

I will helpfully not answer this question. Instead I will hope to eliminate the confusion that many of the askers seem to have about the various different