Zach Browne zachbrowne

View Ubuntu Commands
1 2 3 4 5 6 7 8 9 10
Handy bash commands for finding out stuff in Linux:
# Find CPU specifications
cat /proc/cpuinfo
 
# Find running kernel version
uname -r
 
# What compiler version do I have installed
gcc -v
gcc --version
View .bashrc
1 2 3 4 5 6 7 8 9 10
PS1='\[\033[1;31m\]\W/\[\033[0m\] '
 
##### DEFAULTS #####
 
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
 
PROMPT_COLOR='35;1m'
 
export HISTCONTROL=ignoreboth
View gist:6113052
1 2 3 4 5 6 7 8 9 10
#!/bin/bash
 
#############################################################
# Setup Ubuntu 12.04 32/64 Natty Web Server for WordPress #
# by Zach Browne - http://zachbrowne.com #
#############################################################
 
## Setup SSH
 
mkdir ~/.ssh/
View instructions.txt
1 2 3 4 5 6 7 8 9 10
git clone git://github.com/imathis/octopress.git zachbrowne.github.io
cd zachbrowne.github.io
bundle install
rake install
rake setup_github_pages
rake generate
rake deploy
git init
git remote add origin https://github.com/zachbrowne/zachbrowne.github.com.git
git config branch.master.remote origin
View installation.txt
1 2 3 4 5 6 7 8 9 10
# installing all the prerequisites
apt-get install -y openssh-server python-software-properties \
gnome-session-fallback \
ubuntu-desktop --no-install-recommends
 
# If you don't install the package gnome-session-fallback, when you
# will remote connect to your freenx pc, the freenx client will throw
# the error gnome-session-fallback not found and it will close the
# connection.
View custom.css
1 2 3 4 5 6 7 8 9 10
/* Home Contact
------------------------------------------------------------ */
 
#home-contact {
width: 100%;
background-color: #f1f1f1;
border-bottom: 1px solid #bbb;
clear: both;
margin: 0 auto;
overflow: hidden;
View add.sql
1
GRANT ALL ON DATABASE.* TO USER@'IP_ADDRESS' IDENTIFIED BY 'PASSWORD';
View htaccess.txt
1 2 3 4 5 6 7 8 9 10
# Accompanies this blog post:
# http://www.seomoz.org/blog/htaccess-file-snippets-for-seos
 
# NOTE: This file isn't designed to be used all together, some of the rules will conflict,
# it is meant more as a copy and paste board.
 
# IMPORTANT: Make sure you test .htaccess changes thoroughly, as it can be easy to make mistakes
# and then you end up in a bad place!
 
RewriteEngine On
View instructions.txt
1 2 3 4
mysql -u root -p
CREATE DATABASE testing;
GRANT ALL PRIVILEGES ON testing.* TO test_user@localhost IDENTIFIED BY 'test_pass';
FLUSH PRIVILEGES;
View php.txt
1 2 3 4 5 6 7 8 9 10
1. If a method can be static, declare it static. Speed improvement is by a factor of 4.
2. echo is faster than print.
3. Set the maxvalue for your for-loops before and not in the loop.
4. Unset your variables to free memory, especially large arrays.
5. Avoid magic like __get, __set, __autoload
6. require_once() is expensive
7. Use full paths in includes and requires, less time spent on resolving the OS paths.
8. If you need to find out the time when the script started executing, $_SERVER['REQUEST_TIME'] is preferred to time()
9. See if you can use strncasecmp, strpbrk and stripos instead of regex
10. str_replace is faster than preg_replace, but strtr is faster than str_replace by a factor of 4
Something went wrong with that request. Please try again.