Skip to content

Instantly share code, notes, and snippets.

#!/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 / 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;
@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
#[allow(dead_code)]
struct Point {
x: uint,
y: uint,
}
#[allow(dead_code)]
struct Cell {
point: Point,
isWall: bool
@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
@icecreammatt
icecreammatt / PromptDefaults.sh
Created August 24, 2014 00:12
Example on how to default prompt questions
echo "Check for updates? [Y/n] \c"
read CHECK_FOR_UPDATE
case "$CHECK_FOR_UPDATE" in
(N|n) echo "Skipping" ;;
*) echo "installing" ;;
esac
@icecreammatt
icecreammatt / gist:f2dfaf34226b47d015da
Created October 5, 2014 07:11
Docker without Sudo
vagrant@vagrant-ubuntu-trusty-64:~$ docker ps -a
2014/10/05 07:08:23 Get http:///var/run/docker.sock/v1.12/containers/json?all=1: dial unix /var/run/docker.sock: permission denied
vagrant@vagrant-ubuntu-trusty-64:~$ sudo gpasswd -a vagrant docker
Adding user vagrant to group docker
vagrant@vagrant-ubuntu-trusty-64:~$ sudo service docker restart
docker: unrecognized service
vagrant@vagrant-ubuntu-trusty-64:~$ sudo service docker.io restart
docker.io stop/waiting
docker.io start/running, process 4628
vagrant@vagrant-ubuntu-trusty-64:~$ docker ps -a
#!/bin/bash
# Pad a list of images with 0's
# %03d means pad with 3 0's, 4.jpg renamed to 004.jpg
images=$(ls *.jpg)
for image in $images;
do
echo $image
value=$(echo $image | sed 's/.jpg//')
padded=$(printf "%03d" $value)
echo $padded.jpg
@icecreammatt
icecreammatt / gist:b518ce4897c8644c3e76
Created November 21, 2014 18:13
Enyo video player mouse auto hide
//* Resets the timeout, or wakes the overlay.
mousemove: function(inSender, inEvent) {
if (this.isOverlayShowing()) {
this.resetAutoTimeout();
} else if (this.shakeAndWake) {
this.showFSControls();
}
},
//* Sets _this.visible_ to true and clears hide job.
showFSControls: function(inSender, inEvent) {
#!/bin/bash
# git pre-commit hook that runs an clang-format stylecheck.
# Features:
# - abort commit when commit does not comply with the style guidelines
# - create a patch of the proposed style changes
# modifications for clang-format by [email protected]
# This file is part of a set of unofficial pre-commit hooks available
# at github.