Skip to content

Instantly share code, notes, and snippets.

View bitbeans's full-sized avatar

Christian Hermann bitbeans

View GitHub Profile
@bitbeans
bitbeans / dnscrypt_install_ubuntu.sh
Created February 28, 2018 19:39
Install dnscrypt server on a vultr.com container
#!/bin/sh
apt-get update
apt-get upgrade -y
ufw enable
ufw allow 22
ufw allow 443
export SERVER=$(hostname)
export SERVER_IP=`ip route get 1 | awk '{print $NF;exit}'`
echo $SERVER
echo $SERVER_IP
@bitbeans
bitbeans / dnscrypt_install.sh
Last active January 31, 2018 06:10
Automatic installation of dnscrypt on vultr. com
#!/bin/sh
yum -y update
export SERVER=$(hostname)
export SERVER_IP=`ip route get 1 | awk '{print $NF;exit}'`
echo $SERVER
echo $SERVER_IP
docker run --name=dnscrypt-server -p 443:443/udp -p 443:443/tcp --net=host jedisct1/dnscrypt-server init -N $SERVER -E $SERVER_IP:443
docker update --restart=unless-stopped dnscrypt-server
docker run -d --name watchtower -v /var/run/docker.sock:/var/run/docker.sock v2tec/watchtower dnscrypt-server
docker update --restart=unless-stopped watchtower
@bitbeans
bitbeans / build_nginx.sh
Created March 8, 2016 13:48 — forked from Belphemur/build_nginx.sh
Compiling Nginx with LibreSSL (and http2) & RTMP module & PageSpeed (optional)
#!/usr/bin/env bash
# names of latest versions of each package
export NGINX_VERSION=1.9.12
export VERSION_PCRE=pcre-8.38
export VERSION_LIBRESSL=libressl-2.3.2
export VERSION_NGINX=nginx-$NGINX_VERSION
#export NPS_VERSION=1.9.32.10
#export VERSION_PAGESPEED=v${NPS_VERSION}-beta
@bitbeans
bitbeans / base58.js
Created November 26, 2015 08:00 — forked from inflammable/base58.js
Base58 (and other) Encoding and Decoding in Javascript
/*
* base58.js
* - encodes integers to and decodes from a base58 (or your own) base58 alphabet
* - based on Flickr's url shortening
*
* usage:
* base58.encode(integer);
* base58.decode(string);
*
* (c) 2012 inflammable/raromachine
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN
Configure | 48 +-
Makefile.org | 4 +-
apps/speed.c | 30 +-
crypto/chacha20poly1305/Makefile | 92 +++
crypto/chacha20poly1305/asm/chacha20_avx.pl | 389 ++++++++++++
crypto/chacha20poly1305/asm/chacha20_avx2.pl | 425 +++++++++++++
crypto/chacha20poly1305/asm/poly1305_avx.pl | 718 +++++++++++++++++++++
crypto/chacha20poly1305/asm/poly1305_avx2.pl | 919 +++++++++++++++++++++++++++
crypto/chacha20poly1305/chacha20.c | 158 +++++
crypto/chacha20poly1305/chacha20poly1305.h | 77 +++
@bitbeans
bitbeans / Pkcs7.cs
Last active July 19, 2019 20:29
PKCS7 padding in C#
/// <summary>
/// Removes the Pkcs7 padding of an array.
/// </summary>
/// <param name="paddedByteArray">The padded array.</param>
/// <returns>The unpadded array.</returns>
/// <exception cref="OverflowException"></exception>
/// <exception cref="ArgumentOutOfRangeException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentNullException"></exception>
public static byte[] RemovePkcs7Padding(byte[] paddedByteArray)
/*
* bitbeans.sodium.js
*
* Copyright (c) 2015 bitbeans
*
* Version: 1.0.0
*
* Uses:
* https://github.com/jedisct1/libsodium.js
* https://github.com/julien-maurel/jQuery-Storage-API

Keybase proof

I hereby claim:

  • I am bitbeans on github.
  • I am bitbeans (https://keybase.io/bitbeans) on keybase.
  • I have a public key whose fingerprint is 6DE2 D6BD 9528 D50C E577 F725 B1A5 04FC 7BA7 2810

To claim this, I am signing this object:

#!/bin/sh
PECLVER="0.1.1"
LIBSODIUMVER="1.0.2"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
gpg --fingerprint 89F7B8300E87E03C52B05289926BC5171CDEA439