Skip to content

Instantly share code, notes, and snippets.

View patinthehat's full-sized avatar

Patrick Organ patinthehat

View GitHub Profile

Keybase proof

I hereby claim:

  • I am patinthehat on github.
  • I am patorgan (https://keybase.io/patorgan) on keybase.
  • I have a public key ASBhWbefCXIWV4Iz-WrG0YjDddd8EkX6lcup20BGLZX3yAo

To claim this, I am signing this object:

@patinthehat
patinthehat / php-cs-fixer-preset-1.php
Last active December 7, 2020 23:45
php-cs-fixer-preset-1.php
<?php
namespace Permafrost\PhpCsFixerRules\Rulesets;
class DefaultRuleset implements RuleSet
{
public function allowRisky(): bool
{
return false;
}
@patinthehat
patinthehat / get-external-ip.php
Created July 15, 2017 04:02
Get your external ip using a randomized host
#!/usr/bin/php
<?php
function get_random_host()
{
$hosts = [
'eth0.me',
'icanhazip.com',
];
@patinthehat
patinthehat / nginx-edit-and-restart
Created July 8, 2017 19:15
Edit any nginx config file and then restart the service.
#!/bin/bash
SCRIPTNAME=$(basename $0)
NGINX_CONFIG_PATH="/etc/nginx"
DEFAULT_EDITOR=$(which nano)
FALLBACK_EDITOR=$(which vim)
[ "$EDITOR" == "" ] && EDITOR="$DEFAULT_EDITOR"
#No filename specified or (-h|--help) flag was passed.
@patinthehat
patinthehat / nginx-safe-restart
Created July 8, 2017 18:52
Restarts nginx only if configuration files are valid
#!/bin/bash
sudo nginx -t
if [ $? -eq 0 ]; then
sudo service nginx restart
else
echo "nginx configuration test failed, not restarting service."
exit 1
fi
@patinthehat
patinthehat / php-get-static-analysis-tools.sh
Created May 3, 2017 12:22
PHP Static Analysis Tools - Download Script
#!/bin/bash
### PHP Static analysis tools
#add directory to your search path
printf '\n\nPATH=$HOME/Development/bin:$PATH\n' >> $HOME/.bashrc
#make sure the directory exists
mkdir -p "$HOME/Development/bin"
cd "$HOME/Development/bin"
@patinthehat
patinthehat / get-my-ip
Created February 28, 2017 16:00
Get your public ip address using eth0.me.
#!/bin/sh
curl eth0.me