Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Powell stringsn88keys

View GitHub Profile
@stringsn88keys
stringsn88keys / gist:b0bb6ba514e474a364606adbac9bd2a8
Last active Apr 7, 2018
AppleScript to track who you're chatting with and save it to a parseable file.
View gist:b0bb6ba514e474a364606adbac9bd2a8
set myFile to open for access (choose file name) with write permission
try
repeat
tell application "System Events"
set frontApp to name of first application process whose frontmost is true
if (frontApp = "HipChat") then
-- set things to entire contents of group 1 of group 1 of group 1 of window 1
-- set things to UI elements of group 1 of group 1 of group 1 of window 1
@stringsn88keys
stringsn88keys / postgres_setup.sh
Created Dec 7, 2017
Setting up old version of Postgres via Homebrew
View postgres_setup.sh
# doh this is a keg-only formula. Had to manually link CLI regardless of install method
# run these to set up
brew tap homebrew/versions
brew install homebrew/versions/postgres94
brew services start postgresql@9.4 export
# in your shell's RC file:
PATH=/usr/local/opt/postgresql@9.4/bin:$PATH
LDFLAGS=-L/usr/local/opt/postgresql@9.4/lib
CPPFLAGS=-I/usr/local/opt/postgresql@9.4/include
@stringsn88keys
stringsn88keys / gosha3.go
Created Jul 22, 2017
Go Sha3 hash search, single threaded and with concurrency of 2.
View gosha3.go
package main
import (
"encoding/base64"
"fmt"
"golang.org/x/crypto/sha3"
"strings"
"time"
)
View stub_settings.rb
# a module included
module StubSettings
def stub_setting(setting_name, setting_value)
allow(Setting).to receive(:[]).with(setting_name).and_return(setting_value)
end
def stub_setting_assignment
allow(Setting).to receive(:[]=) { |setting, value| stub_setting(setting, setting) }
end
end
@stringsn88keys
stringsn88keys / indent.c
Created Jul 6, 2017
C indentation styles from wikipedia "Indent Style"
View indent.c
// From https://en.wikipedia.org/wiki/Indent_style
// K & R
while (x == y) {
something();
somethingelse();
}
// 1TBS
if (x < 0) {
puts("Negative");
@stringsn88keys
stringsn88keys / crontab
Created Jul 3, 2017
Let's Encrypt crontab
View crontab
0 0 1 * * /opt/letsencrypt/letsencrypt-auto certonly --quiet --standalone --renew-by-default -d example.com >> /var/log/letsencrypt/letsencrypt-auto-update.log
@stringsn88keys
stringsn88keys / letsencrypt.sh
Created Jul 3, 2017
get certs via lets encrypt
View letsencrypt.sh
#first time setup only
sudo apt-get install git
sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
# I had to restart apache with a stubbed *.443 section, do this, and then
# add the SSL* directives in.
sudo -H ./letsencrypt-auto certonly --standalone -d example.com
View example.com-new.conf
<Directory /var/www/html/example.com/public_html>
Require all granted
</Directory>
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
Redirect / https://example.com/
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
View wp-config-new.fake.snippet.php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wp_example_com');
/** MySQL database username */
define('DB_USER', 'examplecom');
/** MySQL database password */
define('DB_PASSWORD', '!@(87P@ss');
View initial.vhost.conf
<Directory /var/www/html/example.com/public_html>
Require all granted
</Directory>
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ServerAdmin email@example.com
DocumentRoot /var/www/html/example.com/public_html