Skip to content

Instantly share code, notes, and snippets.

@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
# Maintainer: Nikolay Amiantov <nikoamia@gmail.com>
# 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
user "blah";
password "blah";
pass_auth;
group myserver => "mypi";
task "myperl", group => "myserver", sub {
file "/home/user/myperl.pl",
source => "myperl.pl",
mode => 755;
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
██████████████████████████████████████████████████████████████
██ ██ ██████ ██ ████ ██
██ ██████████ ██ ██ ████ ████ ██████ ██████████ ██
██ ██ ██ ████ ██ ██████ ██ ██ ██ ██ ██
██ ██ ██ ██ ████ ██ ████ ██ ████ ██ ██ ██
██ ██ ██ ████ ████ ██ ██ ████ ██ ██ ██
██ ██████████ ████ ████ ████ ██ ██████████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████████████████ ████ ████████████████████
██ ██ ██ ████ ██ ██ ██████ ████ ██ ██
#!/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
#include <stdio.h>
int main() {
char buf[] = "aaaabbbb";
if (buf[0] == "a") {
if (buf[1] == "b") {
}
}
}
@lancechentw
lancechentw / lance.asc
Last active April 6, 2016 03:09
My PGP Public Key
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2
mQENBFE+4NkBCADpGzVHUnVWD7z0VDeKsXC0A8cN4i5E5ejl1+XTVuOsR+MrbJc/
d+YkkETWXwsZLLo2t0C7rurB0wiUuoTRvnzoigoPh2R4QAp/iykcfit91hNF/mxg
9JXonxh4+5u48DgDUHib9AdkIe4sK706DvjC2ZQjyirbzOPg1jdcK8EzELG4J3tb
1yqwQ4Edq9d2w5hduWEZJi90PptG+q4gZFcXksLDx4F4/wppcraG5g0+8qZciuV2
9rlAdTlY8ZTIClD/VzRSapEAJp9l6Td4phf4o0oYAxPW4GJQDdU/1m+iq0/o3om9
tLzwD9oko2DTgSe3nhSzLZRpatDA9U8e/cMVABEBAAG0H0xhbmNlIENoZW4gPGN5
ZW4wMzEyQGdtYWlsLmNvbT6JATwEEwECACYCGwMHCwkIBwMCAQYVCAIJCgsEFgID
@lancechentw
lancechentw / gist:5982566
Created July 12, 2013 07:25
ethernet-static
CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='198.211.111.197'
#ROUTES=('192.168.0.0/24 via 192.168.1.2')
GATEWAY='198.211.111.193'
DNS=('4.2.2.1')
## For IPv6 autoconfiguration
$ sudo make distclean
===> Cleaning for py27-asn1-modules-0.0.5
===> Deleting distfiles for py27-asn1-modules-0.0.5
$ sudo make install clean
===> License BSD accepted by the user
===> py27-asn1-modules-0.0.5 depends on file: /usr/local/sbin/pkg - found
=> pyasn1-modules-0.0.5.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch http://ftp.tw.freebsd.org/distfiles/pyasn1-modules-0.0.5.tar.gz
===> Fetching all distfiles required by py27-asn1-modules-0.0.5 for building