Skip to content

Instantly share code, notes, and snippets.

View cpach's full-sized avatar

Carl Winbäck cpach

View GitHub Profile

On Twitter the other day, I was lamenting the state of OCSP stapling support on Linux servers, and got asked by several people to write-up what I think the requirements are for OCSP stapling support.

  1. Support for keeping a long-lived (disk) cache of OCSP responses.

    This should be fairly simple. Any restarting of the service shouldn't blow away previous responses that were obtained. This doesn't need to be disk, just stable - and disk is an easy stable storage for most server

@cpach
cpach / .emacs
Last active May 30, 2017 13:16
.emacs
(split-window-horizontally)
(add-to-list 'default-frame-alist '(fullscreen . maximized))
(add-to-list 'load-path "~/.emacs.d/lisp/")
(require 'visual-fill-column)
(setq-default fill-column 80)
(add-hook 'text-mode-hook 'turn-on-visual-line-mode)
(global-visual-fill-column-mode)
$my_group = "x"
foreach ($member in Get-ADGroupMember -Identity $my_group) {
$account = get-aduser $member -properties *
If ($account.co -eq "Sweden" -Or $account.co -eq "Norway" -Or $account.co -eq "Finland") {echo $account.EmailAddress}
}
@cpach
cpach / print_contacts_from_address-book.py
Created November 14, 2015 20:27 — forked from pklaus/print_contacts_from_address-book.py
How to access the Mac OS X Address Book from Python: <http://www.programmish.com/?p=26>
import objc
import AddressBook as ab
import pprint as pp
def pythonize(objc_obj):
if isinstance(objc_obj, objc.pyobjc_unicode):
return unicode(objc_obj)
elif isinstance(objc_obj, ab.NSDate):
return objc_obj.description()
@cpach
cpach / backup_strategy.adoc
Last active November 14, 2015 10:57
Backup strategy for personal data

Backup strategy for personal data

My thoughts about desiging a sound and robust long-term backup strategy for my personal data.

Summary

Considering it’s affordable price tag, Arq seems like an adequate solution for my needs.

@cpach
cpach / main.cf
Last active August 29, 2015 14:18 — forked from twogood/main.cf
Mandrill SMTP relay in Postfix
relayhost = smtp.mandrillapp.com:submission
# http://www.zulius.com/how-to/set-up-postfix-with-a-remote-smtp-relay-host/
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = smtpd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_type = cyrus
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
@cpach
cpach / gist:458454ff84c5878669db
Created December 18, 2014 22:29
Why is it that the smallest edit distance is probably the key size? (Cryptopals challenge #06)
From #cryptopals on Freenode:
Date: 2014-11-25
14:26:53 CET <keyvan> hi i'm working on set 1 challenge 6 and im just wondering why is it that the smallest edit distance is probably the key size ?
14:27:08 CET <keyvan> im uncomfortable moving forward without at least partly understanding why that is...
17:50:25 CET <jjarmoc> you're measuring the amount of variance between blocks; repeats of the key's influence over the ciphertext
17:51:08 CET <jjarmoc> since each byte of the key will affect each byte of plaintext modulo it's length in a similar fashion, it's likely to show up as a skew on the ciphertext toward those values
17:51:17 CET <jjarmoc> does that make sense?
@cpach
cpach / gist:70a6f3b45acc7e6e391a
Last active August 29, 2015 14:11
How do I find the keysize? (Cryptopals challenge #06)

How do I find the keysize? (Cryptopals challenge #06)

”oh, 6 is fiddly as hell” –bnagy

First of all, make sure that you have a working and correct function for measuring Hamming distance. Decent unit tests are helpful here, and also scribbling with pen and paper (to work with ”raw bit patterns”).

As noted in challenge #01, it’s important to always operate on ”raw bytes”. The terminology varies from language to language. In Python, these are called bytes objects, in Racket byte strings, etc. Also, don’t forget to decode the Base64 input from 6.txt.

Then…​

#lang racket
(require net/url)
(define (copy-url-to-file urlstr filepath)
(call/input-url (string->url urlstr)
get-pure-port
(lambda (input-port)
(call-with-output-file filepath
(curry copy-port input-port)))))
(copy-url-to-file "http://localhost/data" "/tmp/lol")