Skip to content

Instantly share code, notes, and snippets.

@junftnt
junftnt / openssl_2way_auth.sh
Created September 8, 2021 15:12 — forked from zapstar/openssl_2way_auth.sh
Steps to create CA, server and client keys + certificates for SSL 2-way authentication
# Move to root directory...
cd /
mkdir keys
cd keys
# Generate a self signed certificate for the CA along with a key.
mkdir -p ca/private
chmod 700 ca/private
# NOTE: I'm using -nodes, this means that once anybody gets
# their hands on this particular key, they can become this CA.
@junftnt
junftnt / create-all.sh
Created June 26, 2021 03:23 — forked from mark-kubacki/create-all.sh
a dummy Certificate Authority for development and testing
#!/bin/bash
#
# Copyright (c) 2015 W. Mark Kubacki <wmark@hurrikane.de>
# Licensed under the terms of the RPL 1.5 for all usages
# http://www.opensource.org/licenses/rpl1.5
#
set -e -o pipefail
CAsubj="/C=DE/ST=Niedersachsen/L=Hannover/O=Dummy CA/CN=Sign-It-All"
@junftnt
junftnt / tls-client.go
Created June 26, 2021 03:23 — forked from michaljemala/tls-client.go
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@junftnt
junftnt / csp.c
Created May 7, 2021 02:53 — forked from Kaiepi/csp.c
CSP in C. Build with `gcc -o csp csp.c -lpthread`
#include <pthread.h>
#include <semaphore.h>
#include <stdlib.h>
#include <stdio.h>
struct channel_node {
void *val;
struct channel_node *next;
struct channel_node *prev;
};
@junftnt
junftnt / csp-channels-with-semaphores
Created May 7, 2021 02:52 — forked from joubertnel/csp-channels-with-semaphores
CSP channels implementation with semaphores
CMSC 421 Operating Systems Lecture Notes
(c) 1994 Howard E. Motteler
Message Passing
================
The goal of critical sections, monitors, etc. is to allow
processes to _communicate_
@junftnt
junftnt / coroutine.h
Created May 7, 2021 02:51 — forked from in4lio/coroutine.h
Coroutines in C
/**
* \file coroutine.h
* \brief Coroutines in C.
* \author Vitaly Kravtsov (in4lio@gmail.com)
* \copyright The MIT License
*
* Coroutine mechanics, implemented using the C language extension "Labels as Values".
* Based on Simon Tatham "Coroutines in C".
*/
@junftnt
junftnt / coro.c
Created May 7, 2021 02:45 — forked from lpereira/coro.c
Simple coroutine implementation in C
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <ucontext.h>
typedef struct coro_t_ coro_t;
typedef struct thread_t_ thread_t;
typedef int (*coro_function_t)(coro_t *coro);
typedef enum {
CORO_NEW,
0 = Success
1 = Operation not permitted
2 = No such file or directory
3 = No such process
4 = Interrupted system call
5 = Input/output error
6 = No such device or address
7 = Argument list too long
8 = Exec format error
@junftnt
junftnt / example.go
Created August 18, 2020 02:25 — forked from mjs/example.go
Example of github.com/pkg/errors
package main
import (
"fmt"
"github.com/pkg/errors"
)
func A() error {
// New errors created with pkg/errors.New() will include a full