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 / pacman.md
Last active April 21, 2020 14:49
Useful pacman commands and packages

Basic usage

pacman -S <package> # Install a package
pacman -Sy # Update package list
pacman -Su # Update installed packages
pacman -Ss <query> # Search packages
pacman -R <package> # Remove a package
pacman -Rs <package> # Remove a package and it's unneeded dependencies
@Alanaktion
Alanaktion / osx-defaults.sh
Created April 7, 2016 16:44
OS X Defaults
# I have issues with OS X's defaults. Luckily, most are easy to change.
# This is heavily based on saetia's gist: https://gist.github.com/saetia/1623487
# Disable autocomplete, which effectively disables that really stupid Escape key autocomplete handler
defaults write -g NSUseSpellCheckerForCompletions -bool false
# Disable window animations
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
# Expand save panel by default
@Alanaktion
Alanaktion / compton.conf
Last active June 28, 2021 18:24
Compton configuration
#################################
#
# Backend
#
#################################
# Backend to use: "xrender" or "glx".
# GLX backend is typically much faster but depends on a sane driver.
backend = "glx";
@Alanaktion
Alanaktion / gpmdp.css
Created September 12, 2016 17:35
Google Play Music Theme
/* This is a hacky stylesheet for making GPM not so ugly. */
/* Fix GPMDB's playlist nav on dark themes */
#playlist-drawer paper-header-panel[at-top] paper-toolbar:not([style-scope]):not(.style-scope),
#playlist-drawer .autoplaylist-section,
#playlist-drawer #recent-playlists-container {
border-bottom-color: <<BACK_SECONDARY>>;
}
/* Remove Hero image */
@Alanaktion
Alanaktion / blur.php
Last active June 8, 2018 20:27
Messing with basic blurs in PHP
<?php
/**
* Output a map
*
* @param array $map
* @param bool $int Round output to integer values
*/
function out(array $map, $int = true) {
foreach($map as $r) {
@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 / linkReplace.js
Last active September 17, 2018 12:02
Replace URLs with links via JS
/**
* Replace URLs with hyperlinks in an element
*
* @param {string} selector
* @return {void}
*/
var linkReplace = function(selector) {
var element = document.querySelector(selector);
var text = element.innerHTML;
text = text.replace(/(https?:\/\/|www\.)[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g, function(match) {
@Alanaktion
Alanaktion / blurImg.php
Created December 15, 2016 23:33
Updated blur.php for PHP's gd library with full RGB
<?php
/**
* Blur values in both directions
* @param resource $src
* @param integer $radius
* @return resource
*/
function blur($src, $radius) {
return bVert(bHoriz($src, $radius), $radius);
@Alanaktion
Alanaktion / arch-setup.sh
Created March 7, 2017 23:56
Antergos Xfce setup
#!/bin/bash
# This script is meant to be run on a fresh install of Antergos with Xfce
function prompt() {
echo -n "$1 [y/n] "
read prompt_response
if [ $prompt_response == 'y' ]; then
return 0
else
return 1
@Alanaktion
Alanaktion / settings.json
Created May 3, 2017 16:40
Micro editor settings
{
"autoclose": true,
"autoindent": true,
"autosave": false,
"colorcolumn": 80,
"colorscheme": "monokai",
"cursorline": true,
"eofnewline": true,
"ignorecase": false,
"indentchar": " ",