Skip to content

Instantly share code, notes, and snippets.

// File: custom_ostream.cpp
// Created: 9/2013
// Author: Vaclav Zeman
//
//
// Copyright (C) 2013, Vaclav Zeman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
@wsargent
wsargent / genca.sh
Last active May 7, 2021 15:16
Generate a certificate authority and trust anchor keystore, using only keytool
#!/bin/bash
export PW=`cat password`
# Create a self signed key pair root CA certificate.
keytool -genkeypair -v \
-alias exampleca \
-dname "CN=exampleCA, OU=Example Org, O=Example Company, L=San Francisco, ST=California, C=US" \
-keystore exampleca.jks \
-keypass:env PW \
@alessandroleite
alessandroleite / cert.java
Last active March 2, 2024 00:41
Generate a self signed X509 certificate with Bouncy Castle
//Generate a self signed X509 certificate with Bouncy Castle.
// StringBuilder sb = new StringBuilder();
//
// for (int i = 0; i < pub.length; ++i)
// {
// sb.append(Integer.toHexString(0x0100 + (pub[i] & 0x00FF)).substring(1));
// }
//
// System.out.println(sb);
// sb.setLength(0);
@jeromerobert
jeromerobert / pandoc-svg.py
Last active September 1, 2023 09:05
Pandoc filter to create PDF files from SVG
#! /usr/bin/env python
"""
Pandoc filter to convert svg files to pdf as suggested at:
https://github.com/jgm/pandoc/issues/265#issuecomment-27317316
"""
__author__ = "Jerome Robert"
import mimetypes
import subprocess
\documentclass[12pt]{extarticle}
\usepackage[a4paper,landscape,margin=0.70in]{geometry}
\usepackage{fontspec}
\usepackage{upquote}
\usepackage{microtype}
\usepackage{multicol}
\usepackage{textcase}
\usepackage{mfirstuc}
\usepackage[hidelinks]{hyperref}
\documentclass[11pt]{extarticle}
\usepackage[paper=a4paper, landscape, margin=0.3in]{geometry}
\usepackage{multicol}
%\setlength\columnseprule{0.5pt}
\setlength\columnsep{2em}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
@wilx
wilx / barrier.c
Last active February 1, 2016 01:28
possible reimplementation of pthread_barrier* API for Cygwin
#include <pthread.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
@granella
granella / generate-certificate-chain.sh
Created June 27, 2016 11:15
Create self-signed certificate with root and ca for development
#!/bin/bash
rm *.jks 2> /dev/null
rm *.pem 2> /dev/null
echo "===================================================="
echo "Creating fake third-party chain root -> ca"
echo "===================================================="
# generate private keys (for root and ca)
@kokes
kokes / cumsum.csv
Last active August 14, 2016 09:16
Víceméně kumulativní suma pro strukturální fondy EU ("evropské fondy"). SŽDC získala skoro 12 % všech prostředků, TOP 5 žadatelů získalo 28 % a prvních 50 získalo polovinu všech rozdělených peněz. Tedy každý řádek je procento peněz, které obdržel ten daný subjekt + všichni nad ním.
IČO Žadatel Smlouva Proplaceno
70994234 Správa železniční dopravní cesty, státní organizace 11.8 % 11.4 %
65993390 Ředitelství silnic a dálnic ČR 22.3 % 22.2 %
00551023 Ministerstvo práce a sociálních věcí 25.4 % 25.0 %
70890692 Moravskoslezský kraj 26.8 % 26.4 %
00005886 Dopravní podnik hl.m. Prahy ,akciová společnost 28.2 % 27.9 %
00216224 Masarykova univerzita 29.5 % 29.3 %
00007064 Ministerstvo vnitra 30.6 % 30.3 %
72496991 Úřad práce České republiky 31.5 % 31.2 %
61989592 Univerzita Palackého v Olomouci 32.4 % 32.2 %