Skip to content

Instantly share code, notes, and snippets.

@icecreammatt
icecreammatt / gist:a26ac0a81a39ff2a29fa
Last active August 29, 2015 14:03
Start Forever automatically on server reboot
echo "@reboot /usr/local/bin/forever start -c /usr/bin/node /home/git/deploy/server.js" | crontab
#[allow(dead_code)]
struct Point {
x: uint,
y: uint,
}
#[allow(dead_code)]
struct Cell {
point: Point,
isWall: bool
@icecreammatt
icecreammatt / add_swap.sh
Created May 23, 2014 07:09
Add 512MB Swap
#!/bin/bash
dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
mkswap /swapfile1
chown root:root /swapfile1
chmod 0600 /swapfile1
swapon /swapfile1
@icecreammatt
icecreammatt / gist:10571312
Created April 13, 2014 06:11
nginx config
upstream localhost {
server 127.0.0.1:50000;
}
server {
#listen 80 default_server;
listen 0.0.0.0:80;
listen [::]:80 default_server ipv6only=on;
#root /usr/share/nginx/html;
#!/bin/bash
# Check to see if the data is already downloaded
if [[ -e ./waterData ]]; then
echo "Water data already downloaded reading from cache";
else
# Data isn't downloaded so grab it from the web
echo "No cached data found downloading water data...";
wget -O waterData "http://nwis.waterdata.usgs.gov/ca/nwis/uv/?search_station_nm=russian%20river&search_station_nm_match_type=beginning&county_cd=06097&index_pmcode_00400=1&index_pmcode_00095=1&index_pmcode_00010=1&index_pmcode_63680=1&group_key=NONE&sitefile_output_format=html_table&column_name=agency_cd&column_name=site_no&column_name=station_nm&range_selection=date_range&begin_date=2008-01-01&end_date=2008-12-31&format=rdb&date_format=YYYY-MM-DD&rdb_compression=value&list_of_search_criteria=county_cd%2Csearch_station_nm%2Crealtime_parameter_selection";
fi
@icecreammatt
icecreammatt / install-redis.sh
Created April 7, 2014 23:49
Install's the latest stable redis release
#!/bin/bash
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
cp src/redis-server /usr/local/bin
cp src/redis-cli /usr/local/bin
@icecreammatt
icecreammatt / regfix.php
Created April 7, 2014 22:29
For fixing Drupal Registory after moving folder location
<?php
define('DRUPAL_ROOT', getcwd());
$_SERVER['HTTP_HOST'] = 'default';
$_SERVER['PHP_SELF'] = '/index.php';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['SERVER_SOFTWARE'] = NULL;
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['QUERY_STRING'] = '';
$_SERVER['PHP_SELF'] = $_SERVER['REQUEST_URI'] = '/';
$_SERVER['HTTP_USER_AGENT'] = 'console';
@icecreammatt
icecreammatt / install-java.sh
Created April 2, 2014 17:30
Install's Java 7 on Ubuntu 12.04
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
apt-get update
apt-get install -y software-properties-common python-software-properties
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install -y oracle-java7-installer curl
apt-get upgrade -y
@icecreammatt
icecreammatt / .gitignore
Created March 28, 2014 17:52
Sublime Text gitignore
Packages/*
Pristine\ Packages
Installed\ Packages
Session.sublime_session
Backup/
.DS_Store
*.swp
!Packages/User
Settings/License.sublime_license
Cache
@icecreammatt
icecreammatt / reset-and-update-all.sh
Last active August 29, 2015 13:55
Reset hard and update all git folders in the current directory
#!/bin/bash
for app in $(ls -d */); {
echo $app;
cd $app;
git reset --hard;
git fetch --all;
git rebase origin/master;
git submodule update;
cd ..;