Skip to content

Instantly share code, notes, and snippets.

View LiamKarlMitchell's full-sized avatar

Liam Mitchell LiamKarlMitchell

View GitHub Profile
@LiamKarlMitchell
LiamKarlMitchell / leagueoflegendsminionsai.md
Last active June 11, 2020 08:25
League of Legends interesting things.

Archived from http://web.archive.org/web/20200308182225/https://boards.na.leagueoflegends.com/en/c/developer-corner/qRHotV9k-minion-ai-rules-documentation and converted to markdown/niceness to read.

Found archived topic on here: https://www.reddit.com/r/summonerschool/comments/99d6my/riot_minion_ai_behavior_documentation/

Hello! I’m Riot Reinboom and I’m here to drop some Sweet minion AI game documentation on you all.

What? We’re sharing our understanding of how a bunch of weird behaviors of how lane minions work internally and figured it would be informative for you all as well.

So, documentation. Exciting stuff.

@LiamKarlMitchell
LiamKarlMitchell / mysql-backup-windows.bat
Created November 17, 2019 04:04 — forked from sindresorhus/mysql-backup-windows.bat
Backup MySQL databases in separate gzipped sql files on Windows
@echo off
set dbUser=root
set dbPassword=password
set backupDir="C:\Documents and Settings\user\Desktop\backup\mysql"
set mysqldump="C:\Program Files\MySQL\MySQL Workbench 5.2 CE\mysqldump.exe"
set mysqlDataDir="C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data"
set zip="C:\Program Files\7-Zip\7z.exe"
:: get date
#!/bin/bash
SENDGRID_API_KEY="SG.YOUR_SENDGRID_API_KEY_HERE"
EMAIL_TO="someemail@work.co.nz"
FROM_EMAIL="SomeServer@work.co.nz"
FROM_NAME="SomeServer"
SUBJECT="Low Disk Space Email"
bodyHTML="<p>Testing sending email using sendgrid from sh.</p>"
maildata='{"personalizations": [{"to": [{"email": "'${EMAIL_TO}'"}]}],"cc":[{"email": "someccemail@work.co.nz"}],"from": {"email": "'${FROM_EMAIL}'",
@LiamKarlMitchell
LiamKarlMitchell / capitalize.js
Last active October 4, 2019 05:13
Capitalize peoples names jQuery snippet.
// Scenario:
// Users enter name in all lowercase or all uppercase it fixes the case.
// This isn't 100% suitable for all names but eh whatever!
// Attempts to resepect intentional ' and " and intentional multiple case.
$.fn.capitalize = function() {
$(this).blur(function(event) {
var box = event.target;
var txt = $(this).val();
var lc = txt.toLocaleLowerCase();
@LiamKarlMitchell
LiamKarlMitchell / PearDatabase-fix.php
Last active September 30, 2019 00:54
Fix vtiger not able to save field changes.
<?php
if ($this->dbType === 'mysql' || $this->dbType === 'mysqli') {
$this->database->Execute("SET SESSION sql_mode = 'ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'");
}
// Either in the mysql config or if you don't want to touch it there you can edit the include/database/PearDatabase.php and put that statement at the bottom of the function connect.
// And for setup
// Edit the
@LiamKarlMitchell
LiamKarlMitchell / downloadFile.js
Last active September 3, 2019 10:34
node.js download file outputs progress and does not re-download already downloaded file.
var fs = require('fs');
var http = require('http');
var forceredownload = false;
function downloadFile(url, file, callback, redirect_count, known_size) {
console.log('Attempting to download ' + url + ' to ' + file);
if (redirect_count) {
if (redirect_count > 5) {
callback('Max redirects reached', url);
return;
@LiamKarlMitchell
LiamKarlMitchell / shell.bat
Created May 10, 2019 13:34
Set location to current directory set path enviroment variable and start a shell Windows PowerShell if available otherwise cmd Command Prompt is used.
@echo off
cd /D "%~dp0"
title Your - Shell
set PATH="%~dp0Your\bin";%PATH%
REM Start powershell if available otherwise use cmd.
for %%i in (powershell.exe) do if "%%~$path:i"=="" (cmd) else start powershell -NoLogo -NoExit -Command "& { $env:Path = \"%PATH%\" }"
@LiamKarlMitchell
LiamKarlMitchell / json-file.php
Last active April 2, 2019 22:20
Load data from and save it to a JSON file on php shutdown exit close.
<?php
namespace LiamKarlMitchell\File;
class JSONFile
{
public $filename;
private $data = array();
public function __construct($filename, $defaults = array())
{
$this->filename = $filename;
@LiamKarlMitchell
LiamKarlMitchell / gist:686e32c5076507d54da1e0e9b7ea0da5
Created October 10, 2018 12:12
Windows 10 waking up from sleep for Windows Update Orchestrator how to fix.
powercfg -lastwake
This will show you what last woke up your PC, in my case it was Windows Updates trying to schedule a restart.
I dont care about that but could not seem to disable it even though I am logged in as an Administrator user?!
Solution download pstools from Microsoft Sysinternals
Run a cmd prompt and disable the scheduled tasks
There is probably a better way to just disable the Wake from Lan option on the task but blah!
@LiamKarlMitchell
LiamKarlMitchell / Find log files.md
Created November 7, 2018 20:47
Find the appropriate log files

Find log files modified in last 5 min.

find / -cmin -5 -type f -name "*.log"

For example I used this to find the Akeneo daemon log so I could tail it for debugging.

tail -100f /var/log/akeneo_daemon.err.log