Skip to content

Instantly share code, notes, and snippets.

View hatchan's full-sized avatar
💭
¯\_(ツ)_/¯

Benno van den Berg hatchan

💭
¯\_(ツ)_/¯
  • Amsterdam, Netherlands
  • 04:25 (UTC +02:00)
View GitHub Profile
@hatchan
hatchan / app.js
Last active December 30, 2015 22:19
var Hapi = require("hapi");
// Create a server with a host, port, and options
var server = new Hapi.Server("0.0.0.0", 3000);
// Add a route
server.addRoute({
"method": "GET",
"path": "/hello",
"config": {
@hatchan
hatchan / aws.json
Created January 30, 2014 09:18
Replace [bucket_name] with your own bucket name.
{
"Statement": [
{
"Action": [
"s3:DeleteObject",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:ListBucket",
"s3:PutObject",
"s3:PutObjectAcl"
@hatchan
hatchan / wercker.yml
Created February 3, 2014 09:50
Adding custom http headers to the wercker s3sync step (https://app.wercker.com/#applications/51c82a063179be4478002245/tab/details)
deploy:
steps:
s3sync:
key-id: $KEY
key-secret: $SECRET
bucket-url: $BUCKET
source-dir: $SOURCE
opts: --add-header="Cache-Control:max-age=3600, public"
@hatchan
hatchan / wercker.yml
Created February 10, 2014 09:39
Update npm in wercker.yml
build:
steps:
- script:
name: update npm
code: |
curl https://npmjs.org/install.sh | sudo clean=y sh
sudo rm -rf /home/ubuntu/tmp/
mkdir -p /home/ubuntu/tmp/
@hatchan
hatchan / wercker.yaml
Created March 4, 2014 08:05
Example of the script step
build:
steps:
- script:
name: seed the database
code: rake db:seed
- script:
name: example multiple commands
code: |
export TEST_VAR=12345
cat $TEST > test.txt
@hatchan
hatchan / wercker.yml
Created March 4, 2014 11:08
npm SELF_SIGNED_CERT_IN_CHAIN error workaround
build:
steps:
- script:
name: disable ca
code: npm config set ca=""
@hatchan
hatchan / echo_test.sh
Last active August 29, 2015 13:56
Exploring quotes in bash
# Desired outcome:
bash -c "echo test"
# Using this variable:
export BASH_OPTIONS="-c \"echo test\""
# Won't work:
set -x
@hatchan
hatchan / wercker.yml
Created March 11, 2014 09:19
Remove /home/ubuntu/tmp directory
build:
steps:
- script:
name: remove tmp directory
code: sudo rm -rf /home/ubuntu/tmp
@hatchan
hatchan / wercker.yml
Created April 25, 2014 09:28
Caching for composer
build:
steps:
- script:
name: enable composer cache
code: |
export COMPOSER_CACHE_DIR="$WERCKER_CACHE_DIR/composer"
mkdir -p $COMPOSER_CACHE_DIR
- script:
name: composer install
code: composer install --no-interaction
build:
steps:
- script:
name: Enable virtual display
code: |-
# Start xvfb which gives the context an virtual display
# which is required for tests that require an GUI
export DISPLAY=:99.0
start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
# Give xvfb time to start. 3 seconds is the default for all xvfb-run commands.