Skip to content

Instantly share code, notes, and snippets.

echo 'obase=16; 123999' | bc
@mattes
mattes / gist:7027269
Created October 17, 2013 15:44
rescue "`gets': Interrupt" ...
trap("SIGINT") { exit! }
@mattes
mattes / wp-cli-install-with-brew.sh
Created October 18, 2013 13:45
Installing WP-CLI under Mac OS with Homebrew
#!/usr/bin/env
# curl https://gist.github.com/mattes/7041760/raw/wp-cli-install-with-brew.sh | bash
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install wp-cli
@mattes
mattes / php-fpm-test.sh
Created November 15, 2013 17:23
test if php fpm is serving files
SCRIPT_FILENAME=/www/localhost/info.php REQUEST_METHOD=GET cgi-fcgi -bind -connect 172.17.0.163:20533
@mattes
mattes / httpd.conf
Created November 23, 2013 14:43
Fresh Apache2 Conf on Mac OS X 10.9 /private/etc/apache2/httpd.conf
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
dscacheutil -flushcache; sudo killall -HUP mDNSResponder;
from datetime import datetime, timedelta
def parse_date_ranges(dates):
if(not dates or not len(dates) > 0):
return False
# make sure to order dates
dates.sort()
# init values
brew install postgres
postgres -D /usr/local/var/postgres
createdb piecemaker2_prod
createdb piecemaker2_dev
createdb piecemaker2_test
@mattes
mattes / docker_inspect_result
Last active August 29, 2015 13:57
docker inspect result example
docker run -t -i -d ubuntu echo "test"
d0f637bfc0350729b07d6a6cd4f03140f6a0951924be86eda28f0fa9954dea23
docker inspect d0f637bfc0350729b07d6a6cd4f03140f6a0951924be86eda28f0fa9954dea23
[{
"ID": "d0f637bfc0350729b07d6a6cd4f03140f6a0951924be86eda28f0fa9954dea23",
"Created": "2014-03-05T21:11:35.763549293Z",
"Path": "echo",
"Args": [
"test"
@mattes
mattes / gae_csv.py
Last active November 14, 2018 17:29
class InitCSVHandler(webapp2.RequestHandler):
def get(self):
fetched = self.request.get('fetched')
if not fetched:
self.response.write("no fetched date")
return
taskqueue.add(url='/create_csv', queue_name='csv', params={'fetched': fetched})
self.response.write("creating " + str(fetched))