Skip to content

Instantly share code, notes, and snippets.

@dkrusky
dkrusky / hmac.java
Created January 27, 2019 10:38
hmac
// API details
String APIKey = "xxxxxxx";
String APISecret = "xxxxxxx";
String APIEndpoint = "https://www.domain.com/api/";
String APIVersion = "1.0";
// an example API call
String action = "/client/authenticate/user/pass/0/xxxx"
// build complete API call
@dkrusky
dkrusky / configure-debian-9-linode.sh
Last active December 23, 2018 02:41
Configure fresh Debian 9 on Linode for hosted site with SSL, firewall, mysql, apache2, and php7.2-fpm
#!/bin/bash
# set the dyndns name you want to allow access from
dyndns="testing.noip.me"
# set the domain you will be using
domain="testing.com"
# set the email address for letsencrypt
email="info@testing.com"
@dkrusky
dkrusky / get-letsencrypt-key-pin.sh
Last active December 20, 2018 20:57
LetsEncrypt get sha256 keypin headers for HSTS/HPKP apache2
#!/bin/bash
HPKP=`openssl x509 -in /etc/letsencrypt/live/"$1"/cert.pem -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64`
echo "<IfModule mod_headers.c>"
echo " Header Always set Strict-Transport-Security \"max-age=31536000; includeSubdomains; preload\" env=HTTPS"
echo " Header always set Public-Key-Pins \"pin-sha256=\\\"$HPKP\\\"; max-age=5184000"
echo "</IfModule>"
@dkrusky
dkrusky / HMAC.swift
Created November 26, 2018 00:36 — forked from MihaelIsaev/HMAC.swift
Easy to use Swift implementation of CommonCrypto HMAC. You can easily hash your String to: md5, sha1, sha224, sha256, sha384, sha512 with pure Swift.
//
// HMAC.swift
//
// Created by Mihael Isaev on 21.04.15.
// Copyright (c) 2014 Mihael Isaev inc. All rights reserved.
//
// ***********************************************************
//
// How to import CommonCrypto in Swift project without Obj-c briging header
//
@dkrusky
dkrusky / Program.cs
Created July 30, 2018 16:04
ZygorGuides Fixer (Console C#) - Removes references to files and guides that dont exist as well as Trial references, and removes languages that aren't in your current Locale.
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace ZygorFixer {
class Program {
// property to store world of warcraft install path
public static string InstallPath { get; private set; }
@dkrusky
dkrusky / TitanClock.lua
Created July 20, 2018 19:07
Titan Panel patch to work with World of Warcraft BFA pre-patch 8.0.1
-- **************************************************************************
-- * TitanClock.lua
-- *
-- * By: TitanMod, Dark Imakuni, Adsertor and the Titan Development Team
-- **************************************************************************
-- ******************************** Constants *******************************
TITAN_CLOCK_ID = "Clock";
local TITAN_CLOCK_FORMAT_12H = "12H";
local TITAN_CLOCK_FORMAT_24H = "24H";
@dkrusky
dkrusky / mysqli2mysqli.php
Created April 18, 2018 09:05
Wrapper to convert a php site mysql_ procedural to mysqli_ without having to change any code where mysql_ procedural commands are no longer available. (migrating from php 5 to php 7)
<?php
// include this file somewhere that the entire project will have access to it, and disable the old mysql extension.
if(!function_exists('mysql_connect')) {
function mysql_connect($server, $username, $password, $new_link=false) {
return mysqli_connect($server, $username, $password );
}
function mysql_query( $query, $link_identifier ) {
return mysqli_query($link_identifier, $query);
@dkrusky
dkrusky / grant-root-remote-with-grant.sql
Created April 3, 2018 10:30
Grant root full remote access to mysql database with grant abilities
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;
@dkrusky
dkrusky / install-mysql-apt-debian-9.sh
Created February 26, 2018 05:56 — forked from anonymous/install-mysql-apt-debian-9.sh
Install MySQL APT for Debian 9
#!/bin/bash
apt install dirmngr
apt-key adv --keyserver pgp.mit.edu --recv-keys 5072E1F5
echo 'deb http://repo.mysql.com/apt/debian/ stretch mysql-5.7' > /etc/apt/sources.list.d/mysql.list
apt update
apt upgrade
apt install mysql-community-server
@dkrusky
dkrusky / install-python
Created April 11, 2017 18:57
Install specified version of Python from source on Debian 8
#!/bin/bash
if [ -z "$1" ]
then
echo "Syntax: install-python <version>"
echo "Example: install-python 3.6.1"
exit;
fi
apt-get install packaging-dev debian-keyring devscripts equivs python python-dev python3 python3-dev python3-pip libxml2-dev libacl1-dev direnv
wget https://www.python.org/ftp/python/$1/Python-$1.tgz
tar xvf Python-$1.tgz