Skip to content

Instantly share code, notes, and snippets.

@tsenger
tsenger / CardDav2GrandstreamXML.py
Created December 20, 2018 08:25
Converter for CardDav phonebook to Grandstream DP720 / DP750 XML phonebook
#Convert CardDav contacts to GrandStream DP720 / DP750 XML phonebook
import vobject
vcf_path = "./contacts.vcf"
xml_path = './xml_contacts.xml'
# phone number: CardDav to Grandstream
map_number_types = {
"work": "Work",
@tsenger
tsenger / letsencrypt_notes.sh
Created March 23, 2018 15:16 — forked from lachesis/letsencrypt_notes.sh
Set up LetsEncrypt using acme.sh without root
# How to use "acme.sh" to set up Lets Encrypt without root permissions
# See https://github.com/Neilpang/acme.sh for more
# This assumes that your website has a webroot at "/var/www/<domain>"
# I'll use the domain "EXAMPLE.com" as an example
# When this is done, there will be an "acme" user that handles issuing,
# updating, and installing certificates. This account will have the following
# (fairly minimal) permissions:
# - Host files at http://EXAMPLE.com/.well-known/acme-challenge
@tsenger
tsenger / jc_HmacSha256.java
Created October 23, 2017 14:43
JavaCard implementation of HMAC SHA256
private short computeHmacSha256(byte[] key, short key_offset, short key_length,
byte[] message, short message_offset, short message_length,
byte[] mac, short mac_offset){
short BLOCKSIZE=64;
short HASHSIZE=32;
// compute inner hash
for (short i=0; i<key_length; i++){
hmacBuffer[i]= (byte) (key[(short)(key_offset+i)] ^ (0x36));
@tsenger
tsenger / PACEPinpadTester.java
Created March 9, 2016 13:30
Test for PACE per PCSC reader with pinpad
package de.tsenger.sandbox;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.smartcardio.Card;
import javax.smartcardio.CardException;
import javax.smartcardio.CardTerminal;
import javax.smartcardio.TerminalFactory;