Skip to content

Instantly share code, notes, and snippets.

@ChrisMcKee
ChrisMcKee / Epoch.cs
Created February 11, 2014 11:34
unix epoch helper
using System;
public static class UnixUtils
{
public static DateTime FromUnixTimeStamp(this Int64 unixTimestamp)
{
return new DateTime(1970, 1, 1).AddMilliseconds(unixTimestamp);
}
public static Int64 ToUnixTimeStamp(this DateTime date)
@ChrisMcKee
ChrisMcKee / vrmdateident.json
Created February 14, 2014 11:13
VRM ident to year and month (data file)
{
"vrmdates": [
{
"y": 1983,
"m": 1,
"ident": "Y"
},
{
"y": 1983,
"m": 8,
@ChrisMcKee
ChrisMcKee / string helper.cs
Created March 3, 2014 22:48
String to Byte Array and Reverse
public static class StringHelper
{
public static byte[] ToByteArray(this string str)
{
byte[] bytes = new byte[str.Length * sizeof(char)];
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
return bytes;
}
public static string GetString(this byte[] bytes)
@ChrisMcKee
ChrisMcKee / installHaProxy.sh
Last active August 29, 2015 13:57
Install HA Proxy 1.5 Dev on CentOS ; Source for installs/versions http://haproxy.1wt.eu/download/1.5/src/devel/
#!/bin/bash
### VARIABLES ###
PRE_PACK="openssl-devel pcre-devel make gcc"
VER="1.5-dev22"
# Setup Colours
black='\E[30;40m'
red='\E[31;40m'
@ChrisMcKee
ChrisMcKee / update-openssl-heartbleedpath.sh
Last active August 29, 2015 13:58
Install openssl from source for Heatbleed patch
echo "Installing OpenSSL"
yum -y -q install gcc gcc-c++ make pcre-devel zlib-devel unzip wget > /dev/null
mkdir -p /src
cd /src
# download openssl centos 6.x
wget -cnv --progress=bar http://www.openssl.org/source/openssl-1.0.1g.tar.gz
tar xvzf openssl-1.0.1g.tar.gz
@ChrisMcKee
ChrisMcKee / nginx
Created April 8, 2014 01:20
Ubuntu NGINX Init.d
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
#! /bin/sh
##
# Generated by Chef
# <%= Time.now %>
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select