Skip to content

Instantly share code, notes, and snippets.

View stringsn88keys's full-sized avatar

Thomas Powell stringsn88keys

View GitHub Profile
@stringsn88keys
stringsn88keys / mysqldump command
Last active July 3, 2017 15:39
Mysqldump example for extracting wordpress
mysqldump wp_example_com --host mysql.db.example.com -u examplecom -p > example.com.sql
@stringsn88keys
stringsn88keys / apache2.conf
Created July 3, 2017 16:22
Apache2 conf snippet
<Directory /var/www/html/example.com/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<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
@stringsn88keys
stringsn88keys / wp-config-new.fake.snippet.php
Created July 3, 2017 16:46
Another fake wp-config snippet
// ** 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');
@stringsn88keys
stringsn88keys / example.com-new.conf
Last active July 3, 2017 17:05
Final apache 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
@stringsn88keys
stringsn88keys / letsencrypt.sh
Created July 3, 2017 17:04
get certs via lets encrypt
#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
@stringsn88keys
stringsn88keys / crontab
Created July 3, 2017 17:07
Let's Encrypt 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 / indent.c
Created July 6, 2017 10:57
C indentation styles from wikipedia "Indent Style"
// From https://en.wikipedia.org/wiki/Indent_style
// K & R
while (x == y) {
something();
somethingelse();
}
// 1TBS
if (x < 0) {
puts("Negative");
@stringsn88keys
stringsn88keys / stub_settings.rb
Created July 7, 2017 14:34
Stubbing Rails Settings
# 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 / gosha3.go
Created July 22, 2017 16:31
Go Sha3 hash search, single threaded and with concurrency of 2.
package main
import (
"encoding/base64"
"fmt"
"golang.org/x/crypto/sha3"
"strings"
"time"
)