Skip to content

Instantly share code, notes, and snippets.

View Aetherinox's full-sized avatar

Aetherinox Aetherinox

View GitHub Profile
@madd0
madd0 / md5.cs
Created November 15, 2011 09:06
Create an MD5 hash digest in C#
public static string MD5Hash(string toHash)
{
string hashed;
using (MD5 md5 = MD5.Create())
{
hashed = string.Join(string.Empty, md5.ComputeHash(Encoding.UTF8.GetBytes(toHash)).Select(b => b.ToString("x2")));
}
return hashed;
@baywet
baywet / pfxtosnk.cs
Created October 4, 2014 00:39
sample on how to convert a pfx to snk visual studio assembly signing certificate
X509Certificate2 cert = new X509Certificate2(@"KEY.pfx", "pfxPassword", X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet);
RSACryptoServiceProvider provider = (RSACryptoServiceProvider) cert.PrivateKey;
byte[] array = provider.ExportCspBlob(!provider.PublicOnly);
using (FileStream fs = new FileStream("FileName.snk", FileMode.Create, FileAccess.Write))
{
fs.Write(array, 0, array.Length);
}
@zachbonham
zachbonham / crypto.cs
Created September 10, 2012 17:57
RSA public key encryption in C#
using System;
using System.Diagnostics;
using System.Security.Cryptography;
using System.Text;
namespace Crtypto
{
class Program
{
static void Main(string[] args)
@dylancwood
dylancwood / tree.css
Last active August 2, 2024 04:06
CSS to create a simple tree structure with connecting lines. No images or JS required.
ul.tree, ul.tree ul {
list-style: none;
margin: 0;
padding: 0;
}
ul.tree ul {
margin-left: 10px;
}
ul.tree li {
margin: 0;
@alexanderadam
alexanderadam / Dockerfile
Created March 11, 2020 12:41 — forked from blacksheep--/Dockerfile
Traefik Catch-All to return HTTP421 for unresolved routes
FROM golang:1.14-alpine
COPY . /go/src/app
WORKDIR /go/src/app
RUN go get -v -d
RUN go install
CMD ["app"]
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active September 17, 2024 08:31
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@ikbelkirasan
ikbelkirasan / host_apt_repo_on_github.md
Last active September 21, 2024 02:30
Host an APT repository on Github

Host an APT repository on Github

This guide will help you host an APT repository on Github.

Prerequisites

You need to install the following packages.

  • reprepro
@computerquip
computerquip / ut2004-key-gen.py
Last active September 22, 2024 03:25
UT2004 Key Generator Bottle App
from bottle import default_app, route
import hashlib
import ctypes
import secrets
# Copyright (c) 2005-2023, NumPy Developers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@elklein96
elklein96 / self_signed_certs.md
Created February 14, 2018 04:32
A quick guide for creating self-signed certificates using OpenSSL

Creating a Self-Signed Certificate

Prerequisites

  • You'll need to install OpenSSL to create and sign certificates.
    • Linux: sudo apt-get install openssl
    • MacOS: brew install openssl

Getting Started

@cskeeters
cskeeters / broadcast_calc.sh
Created December 8, 2016 19:17
Bash script for calculating network and broadcast addresses from ip and netmask or CIDR Notation
#!/bin/bash
# Calculates network and broadcast based on supplied ip address and netmask
# Usage: broadcast_calc.sh 192.168.0.1 255.255.255.0
# Usage: broadcast_calc.sh 192.168.0.1/24
tonum() {
if [[ $1 =~ ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+) ]]; then