Skip to content

Instantly share code, notes, and snippets.

//**********************************************************************************
//
//OpenSSLKey
// .NET 2.0 OpenSSL Public & Private Key Parser
//
// Copyright (C) 2008 JavaScience Consulting
//
//***********************************************************************************
//
// opensslkey.cs
@lenew
lenew / tun-ping-linux.py
Created September 29, 2017 16:35 — forked from glacjay/tun-ping-linux.py
Reading/writing Linux's TUN/TAP device using Python.
import fcntl
import os
import struct
import subprocess
# Some constants used to ioctl the device file. I got them by a simple C
# program.
TUNSETIFF = 0x400454ca
TUNSETOWNER = TUNSETIFF + 2
@lenew
lenew / CreateValidateJWT.cs
Created September 21, 2017 10:46 — forked from bschapendonk/CreateValidateJWT.cs
How to create and validate a JWT using System.IdentityModel.Tokens.Jwt
using System;
using System.IdentityModel.Tokens;
using System.Security.Claims;
using System.Security.Cryptography;
namespace CreateValidateJWT
{
class Program
{
static void Main(string[] args)
@lenew
lenew / dh.c
Created March 29, 2017 05:50 — forked from cloudwu/dh.c
Diffie-Hellman Key Exchange
// The biggest 64bit prime
#define P 0xffffffffffffffc5ull
#define G 5
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
#include <stdlib.h>
// calc a * b % p , avoid 64bit overflow
package main
import (
"flag"
"fmt"
"github.com/miekg/dns"
"os"
)
var (
@lenew
lenew / install-redis.sh
Created March 22, 2016 06:24 — forked from FUT/install-redis.sh
Install Redis on EC2
1. Install Linux updates, set time zones, followed by GCC and Make
sudo yum -y update
sudo ln -sf /usr/share/zoneinfo/America/Indianapolis \
/etc/localtime
sudo yum -y install gcc make
2. Download, Untar and Make Redis 2.8 (check here http://redis.io/download)