Skip to content

Instantly share code, notes, and snippets.

View Alanaktion's full-sized avatar
:shipit:
Working on too many things.

Alan Hardman Alanaktion

:shipit:
Working on too many things.
View GitHub Profile
@Alanaktion
Alanaktion / timing-attack.php
Last active June 12, 2018 23:00
Silly timing attack POC in PHP
<?php
$iterations = 1e4;
$valid = 'password';
$stored_hash = md5($valid);
$test = $arvg[1] ?? 'notvalid';
echo "$iterations iterations\n";
// Run tests
$v_start = microtime(true);
@Alanaktion
Alanaktion / Celeste Dark.sublime-color-scheme
Last active February 16, 2024 03:27
Celeste Dark Sublime Text Theme
{
// Rough modified version of Celeste to darken it up
"name": "Celeste Dark",
"author": "Sublime HQ Pty Ltd",
"variables":
{
// These colors are part of the hashed range
// and should only be used in non-source
"purple": "hsla(260, 50%, 70%, 1)",
"blue": "hsla(200, 70%, 55%, 1)",
@Alanaktion
Alanaktion / README.md
Created April 16, 2018 14:12
Pacman hooks to keep kernel modules

These Pacman hooks can be used to keep old kernel modules active without rebooting. This can work around issues like new USB devices and Docker images not working properly after a kernel upgrade, but before a reboot.

Add the files to /etc/pacman.d/hooks to enable the functionality. It works by making a backup of your current kernel's /lib/modules/... directory before the new kernel is installed, and then moving it back to the /lib/modules directory after the installation completes, working around the default behavior of deleting the old modules.

You can manually clean up the files after a reboot if you're concerned about the disk space used.

@Alanaktion
Alanaktion / magento_url_rewrite.patch
Last active December 5, 2017 18:07 — forked from edannenberg/magento_url_rewrite.patch
Fixes the catalog url rewrite indexer in Magento 1.7.x-1.9.x
diff -rupN mage_org/app/code/core/Mage/Catalog/Model/Url.php src_shop/app/code/core/Mage/Catalog/Model/Url.php
--- mage_org/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:48:25.679009391 +0100
+++ src_shop/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:49:24.188005601 +0100
@@ -643,13 +643,24 @@ class Mage_Catalog_Model_Url
$this->_rewrite = $rewrite;
return $requestPath;
}
+
+ // avoid unnecessary creation of new url_keys for duplicate url keys
+ $noSuffixPath = substr($requestPath, 0, -(strlen($suffix)));
@Alanaktion
Alanaktion / .gitconfig
Last active September 16, 2019 15:04
Global Git config
[user]
name = Alan Hardman
email = alanaktion@gmail.com
signingkey = 27A79A65774B4AF0
[push]
default = simple
[alias]
ignored = !git ls-files -v | grep ^[[:lower:]]
sync = !sh -c 'git pull --no-edit && git push'
st = status
@Alanaktion
Alanaktion / Monokai Breeze.tmTheme
Created November 13, 2017 18:11
Monokai color scheme adjusted to match Breeze theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai Soda</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@Alanaktion
Alanaktion / Default (Linux).sublime-mousemap
Created November 13, 2017 18:09
Windows-style mouse bindings for Sublime Text on Linux
[
{
"button": "button3",
"press_command": "drag_select",
"press_args": {"by": "columns"}
},
{
"button": "button3", "modifiers": ["ctrl"],
"press_command": "drag_select",
"press_args": {"by": "columns", "additive": true}
@Alanaktion
Alanaktion / upgrade.php
Last active November 9, 2017 16:36 — forked from colinmollenhour/cleanCache.php
Safely run Magento 1.x upgrade scripts via CLI
<?php
/**
* Set global/skip_process_modules_updates to '1' in app/etc/local.xml and
* then use this script to apply updates and refresh the config cache without
* causing a stampede on the config cache.
*
* It should be placed in the shell/ directory, and must be run via CLI.
*/
if(strtolower(php_sapi_name()) != 'cli'){
exit;
@Alanaktion
Alanaktion / f3ws-chat.php
Created October 13, 2017 20:27
Minimal chat server on F3 WS
<?php
require_once 'vendor/autoload.php';
$ws = new \CLI\WS('localhost:8033');
$nicks = [];
// Handle agent connections
$ws->on('connect', function($agent) {
echo sprintf("Client %s connected\n", $agent->id());
print_r($agent->headers());
@Alanaktion
Alanaktion / elastic.php
Created September 6, 2017 05:54
Phproject/Elasticsearch test integration
<?php
/**
* Elasticsearch importer and test client
*/
require_once 'vendor/autoload.php';
$f3 = Base::instance();
$f3->mset(array(
'UI' => 'app/view/',