Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
echo $NEW_USER
timedatectl set-timezone UTC
apt-get update
apt-get dist-upgrade -y
apt-get upgrade -y
useradd $NEW_USER
@dbtlr
dbtlr / add_nginx_redirect.sh
Created February 6, 2017 02:35
Add a redirect for a domain name, over to a new url in Nginx w/ LetsEncrypt ssl cert
#!/bin/bash
FROM_DOMAIN=$1
TO_URL=$2
echo "
server {
listen 80;
server_name $FROM_DOMAIN;
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Domain Name: "
read -e DOMAIN_NAME
echo "Database Name: "
read -e DATABASE_NAME
echo "Database User: "
@dbtlr
dbtlr / jekyll-git-deploy.md
Last active January 6, 2017 19:02
A git based deploy for a Jekyll site.

A post-receive hook designed to take a pushed jekyll git repository and deploy it to a web directoy on the server.

Uses a releases / current symlink to point to the current site.

Deploys would go to: ssh://user@10.0.0.0/var/repo/yourdomain.com.git

@dbtlr
dbtlr / jekyll.nginx.conf
Created January 6, 2017 18:45
Jekyll Nginx config, assumes you're using a versioned deployment dir that matches the domain name and uses Let's Encrypt SSL cert.
server {
listen 80;
server_name yourdomain.com;
return 301 https://yourdomain.com$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name yourdomain.com;
@dbtlr
dbtlr / AddressBookSpec.md
Last active August 29, 2015 14:01
Build an Address Book

The Application

Build an address book application that allows a user to

  • Create a contact group
  • Edit a contact group
  • Delete a contact group
  • Add a contact
  • Edit a contact
  • Delete a contact
-- Setup some tables.
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1;
CREATE TABLE `internal_messages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`owner_user_id` int(11) DEFAULT NULL,
+----------------+-------+---------------------+---------------------+
| sender_user_id | name | num_users_contacted | num_users_responded |
+----------------+-------+---------------------+---------------------+
| 3 | Greg | 1 | 1 |
| 1 | John | 4 | 0 |
| 7 | Linda | 1 | 1 |
| 6 | Sue | 2 | 2 |
+----------------+-------+---------------------+---------------------+
+----+-------+-------------------------------+
| id | name | total_cold_inquiries_received |
+----+-------+-------------------------------+
| 2 | Mike | 1 |
| 4 | Bill | 2 |
| 5 | Kate | 1 |
| 6 | Sue | 1 |
| 7 | Linda | 2 |
| 8 | Mary | 1 |
+----+-------+-------------------------------+
@dbtlr
dbtlr / freetype_fix.sh
Created December 10, 2013 22:13
Fixes freetype installation, as related to the installation of PHP 5.4 on OS X Mavericks.
brew rm freetype
brew install https://raw.github.com/mxcl/homebrew/0e450f2c2be7450934a3fdcc6537e3fa90c118aa/Library/Formula/freetype.rb
brew unlink freetype
brew install freetype # So dependency does not fail
brew switch freetype 2.4.11