Skip to content

Instantly share code, notes, and snippets.

View billjohnston's full-sized avatar
🥳

Bill Johnston billjohnston

🥳
View GitHub Profile
@billjohnston
billjohnston / setup.txt
Last active November 22, 2015 02:07
Amazon ec2 Server Setup
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
UPDATE:
I used 'sudo tasksel install lamp-server' instead of 'sudo tasksel' (then selecting) to stop the SSH problems I've been having with ubuntu 12.04
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Create a amazon aws account (http://aws.amazon.com) and enter the AWS management dashboard (https://console.aws.amazon.com/ec2/home). Select the EC2 tab at the top of the dashboard.
1) Create a Security Group that allows HTTP connections and limited SSH to configure the instance. Click on Security Groups > Create Security Group
- Name: web_access
@billjohnston
billjohnston / setup.txt
Created April 28, 2012 19:15
Installing / Using git
sudo apt-get install git
git config --global user.name Bill Johnston
***Doesn't have to be username***
git config --global user.email email@email.com
***Should be email associated w/ github account***
ssh-keygen -t rsa -C "email@email.com"
@billjohnston
billjohnston / .htaccess
Last active December 10, 2015 03:58 — forked from anonymous/.htaccess
PHP: Simple permalinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#If you want any directories ignored uncomment and edit line below
#RewriteRule ^(dash|admin)($|/) - [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#If in sub directory, add before index.php (ex: admin/index.php)
RewriteRule . index.php [L]
@billjohnston
billjohnston / transferNew.php
Created February 22, 2013 17:46
Transfer wordpress blogs, reupload images, add image as 'featured image' for advanced custom fields. Edit switch statement to fix categories. -Place each file in the respective Wordpress root. -Run transferOld.php in browser and copy the output. -Paste output into transferNew.php and run in browser. -Change offset in transferOld.php and repeat t…
<?php
/////////////////paste wpArray here/////////////////
/////////////////paste wpArray here/////////////////
require_once('wp-load.php' );
global $wpdb;
@billjohnston
billjohnston / smartCrop.php
Created March 7, 2013 23:36
A function that returns the height or width of an image so that it is optimized for a bounding box set to overflow:hidden. The images will keep their aspect ratio and fit the box.
function smartCrop($height,$width,$endHeight,$endWidth){
$heightWidth='';
if($height <= $endHeight || $width <= $endWidth){
$height = round($endWidth*$height/$width);
if($height < $endHeight){
$width = round($endHeight*$width/$height);
$heightWidth = "width:".$width."px";
}
else{
@billjohnston
billjohnston / cheapssl_installation_instructions.txt
Last active December 15, 2015 06:09
Install ssl certificate on ubuntu with apache2
ssl with cheapssl and apache2
-Purchase a ssl certificate
sudo a2enmod ssl
sudo /etc/init.d/apache2 restart
sudo mkdir /etc/apache2/ssl
cd /etc/apache2/ssl
******EDIT THE LINE BELOW WITH DOMAIN******
sudo openssl req -new -nodes -newkey rsa:2048 -keyout MYDOMAIN.key -out MYDOMAIN.csr
@billjohnston
billjohnston / install_phantomjs.txt
Created March 21, 2013 16:24
Install phantomjs on ubuntu
Download phantomjs binary from http://phantomjs.org/download.html
upload to home directory (or where-ever really)
Un-tar the file with:
********************
tar xvjf phantomjs-1.6.1-linux-i686-dynamic.tar.bz2
********************
@billjohnston
billjohnston / transmit_s3_public_instructions.txt
Created March 21, 2013 16:25
Place public-read permission on all files uploaded to amazon s3 with transmit
In Transmit go to:
Transmit > Preferences > Cloud
Select default extension.
Create a new header with the following values:
Name: x-amz-acl
Value: public-read
@billjohnston
billjohnston / .gitignore
Created January 4, 2014 00:29
Make a scheduled node process w/ heroku scheduler
.DS_Store
node_modules/
.nodemonignore
var phantom = require('node-phantom-simple');
var user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36';
var page = 'http://google.com'
phantom.create(function (phantom_err, ph) {
ph.createPage(function (page_err, page) {
page.open(page, function (open_err, status) {
page.evaluate(function(){
return navigator.userAgent;
}, function(err, result){