Skip to content

Instantly share code, notes, and snippets.

@dkrusky
dkrusky / .htaccess
Created January 9, 2017 10:46
handle modern favicons, app path exclusion, seo files, ignore images scripts and fonts, redirect all to page handler and if file not found send different query string to page handler.
RewriteEngine On
# handle modern favicons
RewriteRule ^(browserconfig.xml|manifest.json|safari-pinned-tab.svg|(android-chrome|favicon|mstile)-[0-9]+x[0-9]+.png|apple-touch-icon(-precompressed.png|-[0-9]+x[0-9]+.png|.png)|manifest.json)$ /favicon/$1 [L]
# exclude editor path
RewriteRule ^app\/ - [L]
# handle all seo files
RewriteRule ^(epndomain.txt|LiveSearchSiteAuth.xml|google[A-Za-z0-9]+.xml|[A-Za-z0-9]+.txt|(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|([a-zA-Z0-9][a-zA-Z0-9-_]{1,61}[a-zA-Z0-9]))\.([a-zA-Z]{2,6}|[a-zA-Z0-9-]{2,30}\.[a-zA-Z]{2,3})[A-Za-z0-9]+.html|robots.txt|sitemap.xml)$ display.php?seo=$1 [NC,L]
@dkrusky
dkrusky / wow-bag-items.lua
Created January 9, 2017 10:49
Loop through all items in bags in World of Warcraft
local function countItem(item)
local c
for bag=0,NUM_BAG_SLOTS do
for slot=1,GetContainerNumSlots(bag) do
if item == GetContainerItemID(bag,slot) then
c=c+(select(2,GetContainerItemInfo(bag,slot)))
end
end
end
return c
@dkrusky
dkrusky / adblockextras.txt
Last active January 21, 2017 20:31
Additional blocks for AdBlock that subscriptions still allowed through. Blocks nasty stuff like "... call this 800 number" type messages.
[Adblock Plus 2.0]
! Version: 201701212030
! Title: NastyDropper
! NastyDropper subscription
! Last modified: 21 Jan 2017 20:30 UTC
! Homepage: https://gist.github.com/microvb
js.shoppingthankyoupages.com
||st.chatango.com/h5/gz/r0529151223/id.html
||asdl.us/wp-content/themes/Tuan123456/images/no-thumbnail.png
*.exoclick.com/*
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Collections.Specialized;
class DataService {
public NameValueCollection Query { get; set; }
public string Endpoint { get; set; }
public FormUrlEncodedContent QueryEncoded {
@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
@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 / 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 / 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 / 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 / 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; }