Skip to content

Instantly share code, notes, and snippets.

@Evan-R
Evan-R / es.sh
Last active December 16, 2015 07:49
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.4.deb
sudo dpkg -i elasticsearch-1.3.4.deb
@Evan-R
Evan-R / mysql4_dump_to_mysql5_dump.sh
Last active December 16, 2015 14:39
used to convert mysql4 dump (I'm looking at you, 1and1) to mysql5 dump
# in directory with relevant mysql4 dump(s)..
cat *.sql > MYSQL5DUMP.sql
# replace mysql4 style "type" with mysql5 "engine", and create backup
sed -i.bak -e 's/TYPE=MyISAM/ENGINE=MyISAM/g' MYSQL5DUMP.sql
@Evan-R
Evan-R / wordpressadmin
Created June 7, 2013 08:59
steps to create a wordpress admin account through mysql
Ref: http://www.dnawebagency.com/how-to-add-an-admin-user-to-the-wordpress-database
### wp_users table
user_login – this is the username you want to use to access Wordpress
user_pass – this is the password you want to use to access Wordpress (be sure to select MD5 from the phpMyAdmin Function menu – Wordpress stores passwords with MD5 encryption)
user_nicename – put whatever you would like to refer to yourself as in here (not your username)
user_email – this is the email account associated with this user
user_url – the url to your website like – http://www.dnawebagency.com
user_registered – when was this user registered – just select a date with the date selector

(from http://www.joyceleong.com/log/installing-phantomjs-on-ubuntu/)

  1. cd ~
  2. wget http://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2
  3. sudo mv ~/phantomjs-1.9.1-linux-x86_64.tar.bz2 /usr/local/share
  4. cd /usr/local/share
  5. sudo tar xvf phantomjs-1.9.1-linux-x86_64.tar.bz2
  6. sudo ln -s /usr/local/share/phantomjs-1.9.1-linux-x86_64 /usr/local/share/phantomjs
  7. sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
  8. phantomjs --version
@Evan-R
Evan-R / config
Last active December 26, 2015 22:49
git config
[core]
repositoryformatversion = 0
filemode = false
logallrefupdates = true
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "origin"]
url = <github url>
@Evan-R
Evan-R / common webserver file permissions
Last active December 29, 2015 04:18
useful commands for setting file permissions on web servers
# all directories (recursive)
find {directory} -type d -print0 | xargs -0 chmod 0755
# all files (recursive)
find {directory} -type f -print0 | xargs -0 chmod 0644
# set file permissions (for eg for local dev w/ eclipse ".project", ".buildpath", ".settings")
@Evan-R
Evan-R / phpmyadmin suphp
Created November 24, 2013 10:55
phpmyadmin working with suphp (using php5)
<IfModule mod_php5.c>
<Directory /usr/share/>
<FilesMatch "\.ph(p3?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
</Directory>
</IfModule>
@Evan-R
Evan-R / .htaccess
Created December 9, 2013 18:56
.htaccess security
AuthName "Authorisation Required"
AuthUserFile "/path/to/.htpasswd"
AuthType Basic
require valid-user
ErrorDocument 401 "Authorisation Required"
@Evan-R
Evan-R / gist:9182908
Created February 24, 2014 06:32
Fix FileZilla
sudo mv /usr/bin/filezilla /usr/bin/prog-filezilla
gksudo gedit /usr/bin/filezilla
### contents ----------------------------
#!/bin/bash
export SSH_AUTH_SOCK=""
export UBUNTU_MENUPROXY=0
prog-filezilla
### /end contents -----------------------