Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
# coding: utf-8
"""
qr - Convert stdin (or the first argument) to a QR Code.
When stdout is a tty the QR Code is printed to the terminal and when stdout is
a pipe to a file an image is written. The default image format is PNG.
"""
import sys
import optparse
██████████████████████████████████████████████████████████████
██ ██ ██████ ██ ████ ██
██ ██████████ ██ ██ ████ ████ ██████ ██████████ ██
██ ██ ██ ████ ██ ██████ ██ ██ ██ ██ ██
██ ██ ██ ██ ████ ██ ████ ██ ████ ██ ██ ██
██ ██ ██ ████ ████ ██ ██ ████ ██ ██ ██
██ ██████████ ████ ████ ████ ██ ██████████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████████████████ ████ ████████████████████
██ ██ ██ ████ ██ ██ ██████ ████ ██ ██
import ldap
# ldap server settings
AUTH_LDAP_SERVER_URI = "ldap://ldap.example.com"
AUTH_LDAP_START_TLS = True
# User DN for authentication
AUTH_LDAP_USER_DN_TEMPLATE = 'uid=%(user)s,ou=People,dc=example,dc=com'
# Restrict log in to only members that belong to staff group
user "blah";
password "blah";
pass_auth;
group myserver => "mypi";
task "myperl", group => "myserver", sub {
file "/home/user/myperl.pl",
source => "myperl.pl",
mode => 755;
# Maintainer: Nikolay Amiantov <[email protected]>
# pkgbase=pfixtools-git
# pkgname=(pfix-srsd-git postlicyd-git)
pkgname=pfix-srsd-git
pkgver=0.8.r110.g6096375
pkgrel=1
# pkgdesc="Collection of postfix-related tools."
pkgdesc="This daemon brings SRS to postfix using its tcp_table or socketmap_table mechanisms."
# makedepends=(libsrs2 libev pcre unbound libsrs2 tokyocabinet
@lancechentw
lancechentw / self-signed-certificate
Last active August 29, 2015 14:00
openssl self-signed certificate
# CA
openssl genrsa -des3 -passout pass:x -out ca.pass.key 2048
openssl rsa -passin pass:x -in ca.pass.key -out ca.key
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
# server
openssl genrsa -des3 -out server.key 2048
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
@lancechentw
lancechentw / flex-partition-table
Last active August 29, 2015 14:03
Arch Linux One Step Installer
### Keybase proof
I hereby claim:
* I am Lance0312 on github.
* I am lancechen (https://keybase.io/lancechen) on keybase.
* I have a public key whose fingerprint is F8DA BD84 6787 EBE5 C8CA 58C6 BD3F 87DB 6A0C 53E2
To claim this, I am signing this object:
#!/usr/bin/env python
from jsonschema import Draft4Validator, RefResolver
import json
import os
import sys
if len(sys.argv) != 3:
print("Usage: %s <data file> <schema file>" % sys.argv[0])
exit(1)
@lancechentw
lancechentw / inside.c
Created January 2, 2016 04:33 — forked from stephenR/inside.c
32c3 docker exploit
#include <sys/socket.h>
#include <sys/un.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static void err_quit(const char * const msg) {
puts(msg);
exit(-1);
}