Skip to content

Instantly share code, notes, and snippets.

View mtthlm's full-sized avatar
🐉

Matt Helm mtthlm

🐉
View GitHub Profile
@mtthlm
mtthlm / wordle.sh
Last active February 9, 2022 21:18
Bash Implementation of Wordle (macOS Tested)
#!/usr/bin/env bash
if ! [ "${BASH_VERSINFO:-0}" -ge 4 ]
then
echo 'Bash version >= 4 required, exiting.' 1>&2
if command -v docker &>/dev/null
then
cat - <<'EOS' || true
Looks like you have Docker! Try this:
#!/usr/bin/env bash
set -o errexit -o nounset
IFS=$'\n' read -r -d '' < <(
while [[ $# -gt 0 ]]
do
if [[ "$1" =~ ^([a-zA-Z0-9_]+)=(.+)$ ]]
then printf -- 'declare -- %s=\(%s|tostring);' "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}"
fi
@mtthlm
mtthlm / arch_linux_fde.md
Created August 28, 2015 21:42
Arch Linux FDE

Arch Linux FDE via LVM on LUKS (Including /boot)

Step 1 (Optional): Securely wipe your disk

dd if=/dev/zero of=/dev/sda iflag=nocache oflag=direct bs=4096

Note: More research desired for proper way to wipe disk.

Step 2: Setup SSH

Keybase proof

I hereby claim:

  • I am mtthlm on github.
  • I am mtthlm (https://keybase.io/mtthlm) on keybase.
  • I have a public key whose fingerprint is 0276 DC51 488B 42B9 A1CA 8275 9D88 707F 0F69 D9BD

To claim this, I am signing this object:

@mtthlm
mtthlm / provision.sh
Created August 8, 2014 15:17
Vagrant Puppet Provision Script using RVM and any version of Ruby you desire!
#!/bin/env bash
# Silently install RVM
curl -sSL https://get.rvm.io | bash -s stable > /dev/null 2>&1
# Make RVM command available
source /etc/profile.d/rvm.sh
# Add vagrant User to rvm Group
usermod -a -G rvm vagrant
@mtthlm
mtthlm / index.php
Created June 23, 2014 17:17
Enhanced Foolproof Multi-Environment Config
<?php
define('CRAFT_ENVIRONMENT', call_user_func_array(function ($environments, $fallback) {
if (array_key_exists('APP_ENV', $_SERVER) && in_array($environment = $_SERVER['APP_ENV'], array_keys($environments))) {
return $environment;
}
foreach ($environments as $environment => $value) {
$serverName = $_SERVER['SERVER_NAME'];
@mtthlm
mtthlm / cleanup.sh
Last active December 11, 2017 20:31
A little script to cleanup a Laravel installation
#!/usr/bin/env bash
DIRECTORY=$1
echo ""
if [[ ! -f "${DIRECTORY}/.php_cs" ]]; then
echo -e -n "\033[33m- Downloading PHP-CS-Fixer configuration file...\033[0m"
curl --output "${DIRECTORY}/.php_cs" --silent https://gist.githubusercontent.com/mtthlm/11353191/raw/d6fb1608b0bc7994ee1f8bd15f4a0f30e83ccc91/.php_cs
echo -e "\033[33m Done.\033[0m"
fi
@mtthlm
mtthlm / .php_cs
Created April 27, 2014 19:09
PHP-CS-Fixer config for Laravel
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->notPath('bootstrap/compiled.php')
->notName('composer.*')
->notName('readme.md')
->notName('CONTRIBUTING.md')
->notName('phpunit.xml*')
->in(__DIR__)
;
@mtthlm
mtthlm / hosts.sh
Created February 6, 2014 15:59 — forked from mikeflynn/etchosts.sh
Shell script for managing your /etc/hosts file
#!/bin/bash
HOSTSFILE="/etc/hosts"
BAKFILE="$HOSTSFILE.bak"
DOMAINREGEX="^[a-zA-Z0-9]{1}[a-zA-Z0-9\.\-]+$"
IPREGEX="^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
URLREGEX="^https?:\/\/[a-zA-Z0-9]{1}[a-zA-Z0-9\/\.\-]+$"
backup() {
cat $HOSTSFILE > $BAKFILE
@mtthlm
mtthlm / gist:8788355
Created February 3, 2014 17:32
Apache HTTPD init Script (Stack)
#!/bin/bash
#
# apache2 Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
/usr/local/stack/httpd/bin/apachectl $@