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 / 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 / deb-setup.sh
Last active November 9, 2017 21:02
A perfect Xubuntu setup
#!/bin/bash
# This script is designed to run on Xubuntu 14.04, but should work on
# most Ubuntu and Debian-based distros
##################
# Define globals #
##################
SETUPNAME="Alan's Xubuntu Setup"
DISTRO=`lsb_release -c | awk '{ print $NF }'`
@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 / markov.php
Last active October 17, 2017 03:28
Generate pseudo-random phrases from Markov chains
#!/usr/bin/env php
<?php
if (empty($argv[1]) || $argv[1] == '-h') {
exit ("Usage: markov <input file> [words] [prefix] [minWords]\n");
}
$text = file_get_contents($argv[1]);
$map = map($text);
$words = $argv[2] ?? 20;
$minWords = $argv[4] ?? 10;
@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/',
@Alanaktion
Alanaktion / opensql-pro.desktop
Last active August 2, 2017 22:53
Desktop file for PyGObject app
[Desktop Entry]
Version=1.0
Type=Application
Name=OpenSQL Pro
Comment=A powerfully simple database client
Icon=office-database
Exec=python .
Path=/home/alan/GitHub/opensql-pro
Categories=Development;
StartupNotify=true
@Alanaktion
Alanaktion / ticker.sh
Created June 27, 2017 22:55
Cryptocurrency exchange rate ticker
#!/bin/bash
btc=$(curl -s https://api.coinbase.com/v2/prices/BTC-USD/buy | json data.amount)
eth=$(curl -s https://api.coinbase.com/v2/prices/ETH-USD/buy | json data.amount)
ltc=$(curl -s https://api.coinbase.com/v2/prices/LTC-USD/buy | json data.amount)
echo 'BTC $'$btc' ETH $'$eth' LTC $'$ltc
@Alanaktion
Alanaktion / gnome2xfce.sh
Last active June 16, 2017 20:42
Convert Antergos Gnome to Xfce (assuming gdm)
# This will convert an Antergos Gnome installation to Xfce
# GDM will be replaced with LightDM with the GTK greeter
# It keeps a few Gnome utilities around and installs Xfce4's WhiskerMenu plugin
# Don't continue on errors, since we can really screw up a system if we do
set -e
# Kill existing sessions
sudo systemctl stop gdm