Skip to content

Instantly share code, notes, and snippets.

View zachbrowne's full-sized avatar

Zach Browne zachbrowne

View GitHub Profile
@zachbrowne
zachbrowne / commands.txt
Created August 10, 2012 04:04
Ubuntu Commands Cheat Sheet
# Commands to backup a website from root access to ssh with mysql database
cd to directory of website
# Compress
tar czf filename.tar.gz *
mysqldump -u root -ppassword databasename | gzip -9 > filename.sql.gz
# Decompress
tar xzf filename.tar.gz
gunzip filename.sql.gz
@zachbrowne
zachbrowne / sendemail.php
Created October 31, 2011 06:47
Send HTML Email with PHP
<?php
define("EmailNewLine", "\r\n");
define("EmailXMailer", "PHP-EMAIL, Samplephpcodes.com");
//** the default charset values for both text and HTML emails.
define("DefaultCharset", "iso-8859-1");
function htmlmail($to, $subject,$content,$cc,$bcc)
@zachbrowne
zachbrowne / google_redirect_remove.js
Created March 14, 2012 15:13
Userscript to remove URL redirection from google sites
// ==UserScript==
// @name Google Redirect Remove
// @id google_redirect_remove
// @namespace scripts.zachbrowne.com
// @description Remove URL redirection from google sites
// @license GPL v3
// @include *://www.google.*/*q=*
// @include *://www.google.*/*tbs=*
// @include *://www.google.*/search?*
// @include *://www.google.*/webhp?*
@zachbrowne
zachbrowne / proxyscraper.php
Created October 31, 2011 06:54
Use proxy to scrape with PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<a class="linkclass" href="http://www.example.com">http://www.example.com</a>');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, 'fakeproxy.com:1080');
curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'user:password');
$data = curl_exec();
curl_close($ch);
###############################################################################################
# LAMP setup for Ubuntu 16.04 Server #
# Apache + PHP + Percona #
###############################################################################################
# Update and prepare server
apt update; apt -y upgrade
apt -y install nano sudo curl wget git dnsutils lynx
sudo hostname srv.zdb.bz
sudo service hostname start
@zachbrowne
zachbrowne / cloud9.sh
Created May 9, 2012 14:47
Bash Script to Install Node.js and Cloud9 IDE on Ubuntu
#!/bin/sh
#######################################################
# Another great script by: #
# _ , _ #
# / ) _, _ |) /|/_) ,_ _ _ #
# / / | / |/\ | \/ | / \_| | |_/|/| |/ #
# /__/\/|_/\__/| |/|(_/ |/\_/ \/ \/ | |_/|_/ #
# (| #
# #
@zachbrowne
zachbrowne / craigslist-gigs.opml
Created November 13, 2011 18:29
Craigslist OPML file of All RSS Feeds for "keyword" in Gigs Section
<?xml version="1.0" encoding="ISO-8859-1"?>
<opml version="1.1">
<head>
<title>Craigslist Gigs for "keyword"</title>
<description>Just find and replace "keyword", import into Google Reader and start your job hunt!</description>
<body>
<outline text="AK fairbanks - wordpress" description="Search for wordpress in AK fairbanks" title="AK fairbanks - wordpress" type="rss" version="RSS" htmlUrl="http://fairbanks.craigslist.org/search/ggg?query=wordpress" xmlUrl="http://fairbanks.craigslist.org/search/ggg?query=wordpress&#38;format=rss"/>
<outline text="AK anchorage - wordpress" description="Search for wordpress in AK anchorage" title="AK anchorage - wordpress" type="rss" version="RSS" htmlUrl="http://anchorage.craigslist.org/search/ggg?query=wordpress" xmlUrl="http://anchorage.craigslist.org/search/ggg?query=wordpress&#38;format=rss"/>
<outline text="AK kenai peninsula - wordpress" description="Search for wordpress in AK kenai peninsula" title="AK kenai peninsula - wordpress" type="rss" version="RSS" htm
@zachbrowne
zachbrowne / FindLinks.php
Created October 31, 2011 06:35
Find Out All Links In any Website using PHP
@zachbrowne
zachbrowne / .bashrc
Created July 31, 2013 13:51
Custom .bashrc File for Ubuntu
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
@zachbrowne
zachbrowne / htaccess.txt
Created December 11, 2012 16:16
.htaccess for SEO
# 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