Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# log into your server
ssh root@[server ipaddress]
# change root password
passwd
# update all packages and operating system
apt-get update && apt-get --yes upgrade
@innesm4
innesm4 / JavaScriptfunctionlibrary
Created February 9, 2015 09:26
JavaScript function library
alert("hello");
// Include necessary data
// Initialize the database connection
// Include the common header markup
// Determine the page variables from the POST data
// Load the proper database info using the page vairiables
@innesm4
innesm4 / gist:409684832d74d529b95b
Last active August 29, 2015 14:06
Useful Server Commands
# Check which IPs are hitting a server
netstat -plant | awk '$4~/:80$/{print$5}' | awk -F: '{print$(NF-1)}' | sort | uniq -c | sort -nr | head
# Apache Report
curl -skL apachebuddy.pl | perl
# Last 200 commands of error log
tail -n 200 /var/log/apache2/error.log
# Memory / Max Clients
@innesm4
innesm4 / gist:42d2e1f7fc89b6dfaf43
Created September 4, 2014 10:18
Super Fast Apache.conf
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 30
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#!/bin/sh
# Import a remote database into a local database
# ----------------------------------------------
#
# Based on http://danherd.net/quick-script-synchronise-from-a-remote-expressionengine-database/
#
# Don’t forget chmod +x to make the script executable.
#
# Change the extension to .command to run the script directly from OS X Finder.

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@innesm4
innesm4 / .htaccess
Created July 8, 2014 08:43
Password Protected website
# ----------------------------------------------------------------------
# Password protect server
# ----------------------------------------------------------------------
SetEnvIf Host DOMIANNAME.COM passreq
AuthType Basic
AuthName "Password Required"
AuthUserFile /srv/htpasswd/.htpasswd
Require valid-user
Order allow,deny
@innesm4
innesm4 / New Github Project Setup
Last active August 29, 2015 14:03
New Github Project Setup
Issues
General
=======
Database Ownership
Form Testing
Add On Update
Create Basecamp Project
Define Roles and Responsibilites
export PATH=/Applications/MAMP/bin/php/php5.5.14/bin:$PATH
export PATH=~/.composer/vendor/bin:$PATH
alias bashpro="sudo sublime ~/.bash_profile"
alias reload_profile=". ~/.profile"
alias removeforce="rm -rf"
alias killDS='find . -name *.DS_Store -type f -delete'
alias hconf="sudo sublime /Applications/MAMP/conf/apache/httpd.conf"