Skip to content

Instantly share code, notes, and snippets.

View pschultz's full-sized avatar

Peter Schultz pschultz

  • classmarkets GmbH
  • Berlin, Germany
View GitHub Profile
@pschultz
pschultz / cert.go
Created September 18, 2019 15:33 — forked from jredl-va/cert.go
Certificate Generation
func GenCA(name string) (certPEM, keyPEM []byte, err error) {
now := time.Now().UTC()
tmpl := &x509.Certificate{
SerialNumber: big.NewInt(1),
Subject: pkix.Name{CommonName: name},
NotBefore: now,
NotAfter: now.Add(caMaxAge),
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},
KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
IsCA: true,
@pschultz
pschultz / lru.php
Last active August 29, 2015 14:02 — forked from synboo/lru.php
<?php
/**
* LRU is a system which cache data used last recently.
* see more: http://www.slideshare.net/t_wada/tddbc-exercise
*/
class LRU
{
protected $_cache = array();
@pschultz
pschultz / router.js
Last active October 1, 2017 16:06 — forked from jeffrafter/handler.js
Webservice starting point
var parser = require('url');
var handlers = {};
var Handler = function(callback) {
this.process = function(req, res) {
params = null;
return callback.apply(this, [req, res, params]);
}
}
@pschultz
pschultz / color_test.sh
Last active December 22, 2015 00:19 — forked from esundahl/color_test.sh
function color_test {
# Daniel Crisman's ANSI color chart script from
# The Bash Prompt HOWTO: 6.1. Colours
# http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
#
# This function echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
@pschultz
pschultz / bootstrap.phpunit.php
Created November 27, 2012 08:02 — forked from meddulla/config_test.yml
symfony 2 test configuration
<?php
// in /app/bootstrap.phpunit.php:
require_once __DIR__.'/bootstrap.php.cache';
require_once __DIR__.'/AppKernel.php';
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\ConsoleOutput;