Skip to content

Instantly share code, notes, and snippets.

View plasticbrain's full-sized avatar

Mike Everhart plasticbrain

View GitHub Profile
@plasticbrain
plasticbrain / add_domain.sh
Last active March 12, 2021 07:31
Bash Script to Add a New Domain
#!/bin/sh
################################################################################
# Bash script to add a new domain (Apache2)
# (c) 2014 Mike Everhart | PlasticBrain Media LLC
#
# Prerequisites:
# Create a vhosts "template" in $APACHEDIR/sites-available. The template should
# include placeholders ($TOKEN) that will be replaced with the new domain name.
# See https://gist.github.com/plasticbrain/9620846 for an example template
#
@plasticbrain
plasticbrain / gist:9065764
Last active August 29, 2015 13:56
Installing IP2Location c library and apache module
$ sudo apt-get install autoconf gcc build-essential apache2-prefork-dev apache2-threaded-dev libtool
$ wget http://www.ip2location.com/downloads/ip2location-apache-5.0.0.tar.gz
$ tar xvfz ip2location-apache-5.0.0.tar.gz
$ wget http://www.ip2location.com/downloads/ip2location-c-6.0.2.tar.gz
$ tar xvfz ip2location-c-6.0.2.tar.gz
$ cd ip2location-c-6.0.2/
$ autoreconf -i -v --force
@plasticbrain
plasticbrain / gist:9007765
Created February 14, 2014 19:45
Install Apache GeoIP module
$ sudo apt-get install libapache2-mod-geoip
$nano /etc/apache2/mods-available/geoip.conf
Uncomment "GeoIPDBFile" line
For WorldTrack, the file location is: /var/www/geoip.dat
You should store your .dat file OUTSIDE of your publicly accessible www dir
OR, use .htaccess to deny access to it:
@plasticbrain
plasticbrain / aws-instance.php
Created February 5, 2014 04:13
Get Amazon AWS Instance ID (PHP / wget)
<?php
//---------------------------------------------------------------------------------
// You can get the metadata for an AWS instance by loading the following URL
// Note: This URL must be loaded from an AWS instance
//
//---------------------------------------------------------------------------------
// URL:
// http://169.254.169.254/latest/meta-data/instance-id
//
//---------------------------------------------------------------------------------
@plasticbrain
plasticbrain / cgminer.conf
Created January 20, 2014 22:49
cgminer.conf for Asus HD7870 GHz Edition. 400-405 kh/s, ~380/m WU
{
"pools" : [
{
"url" : "",
"user" : "",
"pass" : ""
},
{
"url" : "",
"user" : "",
@plasticbrain
plasticbrain / cgminer.com
Created January 20, 2014 22:25
cgminer.conf - 2x Gigabyte R9 290x
{
"pools" : [
{
"url" : "",
"user" : "",
"pass" : ""
},
{
"url" : "",
"user" : "",
@plasticbrain
plasticbrain / xfterm-solarized-theme
Created December 28, 2013 06:09
Xubuntu solarized color theme. Paste the following in /etc/xdg/xdg-xubuntu/Terminal/terminalrc
[Configuration]
FontName=Droid Sans Mono 10
ColorCursor=#0f0f49499999
ColorForeground=#838394949696
ColorBackground=#00002b2b3636
ColorPalette1=#070736364242
ColorPalette2=#dcdc32322f2f
ColorPalette3=#858599990000
ColorPalette4=#b5b589890000
ColorPalette5=#26268b8bd2d2
@plasticbrain
plasticbrain / geoip-apache-module
Created November 8, 2013 20:54
Install MaxMind's GeoIP modules for Apache (on Ubuntu)
I. Prerequisites
$ apt-get install apache2-prefork-dev
$ apt-get install apache2-threaded-dev
$ apt-get install libgeoip-dev
1. Download and install mod_geoip2
http://www.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2-latest.tar.gz
@plasticbrain
plasticbrain / gist:7145317
Last active December 26, 2015 11:39
Handy Linux Commands
Get just the IP of a hostname
  • dig +short A <hostname>
Find the 10 largest files on the disk
  • du -a / | sort -n -r | head -n 10
Find/Replace text in files
  • sed -i 's/old-word/new-word/g' *.txt
@plasticbrain
plasticbrain / gist:6582104
Created September 16, 2013 15:22
Update Gnome Terminal Window Title on Login
Edit your .bashrc file:
$ nano ~/.bashrc
Add the following line, changing "New Title" to whatever you want
PROMPT_COMMAND='echo -ne "\033]0;New Title\007"'
NOTE: In some cases, when you switch to root or a different user, the window title may change back. If this is the case, simply add the previous line to /etc/.bashrc