Skip to content

Instantly share code, notes, and snippets.

View ksze's full-sized avatar
Permanently poikilothermic

Kal Sze ksze

Permanently poikilothermic
View GitHub Profile
ksze /
Last active February 8, 2018 06:58 — forked from ahnooie/
Python 3 script to use as a hook for the client
#!/usr/bin/env python3
# How to use:
# LE_HOSTED_ZONE=XXXXXX ./ --cron --domain --challenge dns-01 --hook /tmp/
# More info about
# Using AWS Profiles:
# Obtaining your Hosted Zone ID from Route 53:
ksze / Matplotlib_datetime_rounding_bug.ipynb
Last active August 26, 2016 09:51
matplotlib datetime rounding bug
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
ksze /
Created August 17, 2014 05:25

Keybase proof

I hereby claim:

  • I am ksze on github.
  • I am k_sze ( on keybase.
  • I have a public key whose fingerprint is 3D4A 38D5 0A26 75CF 1589 0092 F5CE EF85 C5CC 4D95

To claim this, I am signing this object:

# -*- coding: utf-8 -*-
# pywin32
from win32api import GetLastError
from win32event import CreateEvent, WaitForSingleObject
from win32file import ReadFile, WriteFile
from win32pipe import CreateNamedPipe, ConnectNamedPipe, DisconnectNamedPipe
$ set -x
++ ps1date
++ local d dow day date time col
++ printf -v d '%(%u_%Y-%m-%d_%a_%H:%M:%S %Z)T' -1
++ dow=6
++ d='2014-06-07_Sat_09:34:57 HKT'
++ date=2014-06-07
++ d='Sat_09:34:57 HKT'
++ day=Sat
++ time='09:34:57 HKT'
def add_employees(request):
# Some preparation... (skipped)
success_msg = ''
roles = get_roles()
if request.method == 'POST':
form = EmployeeForm(request.POST, roles=roles)
if form.is_valid():
# add the employees... (details omitted)
success_msg = 'yay'
<VirtualHost *:80>
RewriteEngine On
RewriteOptions inherit
# Hide the admin interface from the public internet. Make it only accessible from the company office
RewriteCond ${REMOTE_ADDR} !=
RewriteRule ^/admin(/.*)? - [L,R=404]
RewriteRule ^/(.*)$$1 [L,P]
<table cellspacing=0 cellpadding=0>
<tr><td bgcolor="#000000">
</td></tr>olor="#ffffff" face="Arial,Helvetica">SSL/TLS Session Cache Status:</font></b>
<tr><td bgcolor="#ffffff">
cache type: <b>SHMCB</b>, shared memory: <b>512000</b> bytes, current sessions: <b>5</b><br>subcaches: <b>32</b>, indexes per subcache: <b>133</b><br>time left on oldest entries' SSL sessions: avg: <b>160</b> seconds, (range: 40...280)<br>index usage: <b>0%</b>, cache usage: <b>0%</b><br>total sessions stored since starting: <b>1749</b><br>total sessions expired since starting: <b>1744</b><br>total (pre-expiry) sessions scrolled out of the cache: <b>0</b><br>total retrieves since starting: <b>456</b> hit, <b>104</b> miss<br>total removes since starting: <b>0</b> hit, <b>0</b> miss<br></td></tr>
ksze / gist:6279871
Created August 20, 2013 10:37
rabbitmq interface and ports??
$ sudo netstat -anp | grep beam
tcp 0 0* LISTEN 2157/beam
tcp 0 0 ESTABLISHED 2157/beam
tcp6 0 0 :::5672 :::* LISTEN 2157/beam
ksze / gist:6278498
Created August 20, 2013 08:07
## The contents of this file are subject to the Mozilla Public License
## Version 1.1 (the "License"); you may not use this file except in
## compliance with the License. You may obtain a copy of the License
## at
## Software distributed under the License is distributed on an "AS IS"
## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
## the License for the specific language governing rights and
## limitations under the License.