#If you're on Ubuntu or working with a Linux VM...
SSH into your server as a root or do sudo -i.
Then install necessary software:
apt-get update
| # replace PAPERTRAIL_HOSTNAME and PAPERTRAIL_PORT | |
| # see http://help.papertrailapp.com/ for additional PHP syslog options | |
| function send_remote_syslog($message, $component = "web", $program = "next_big_thing") { | |
| $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); | |
| foreach(explode("\n", $message) as $line) { | |
| $syslog_message = "<22>" . date('M d H:i:s ') . $program . ' ' . $component . ': ' . $line; | |
| socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, PAPERTRAIL_HOSTNAME, PAPERTRAIL_PORT); | |
| } | |
| socket_close($sock); |
| /** | |
| * Created by andy hulstkamp | |
| */ | |
| var webpage = require("webpage"), | |
| fs = require("fs"); | |
| var debug = false, | |
| pageIndex = 0, | |
| allLinks = [], |
| FROM ubuntu:14.04 | |
| ENV DEBIAN_FRONTEND noninteractive | |
| # Install, use dev tools, and then clean up in one RUN transaction | |
| # to minimize image size. | |
| ADD dockerfiles/splash/provision.sh /tmp/provision.sh | |
| RUN /tmp/provision.sh \ | |
| prepare_install \ |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
| from flask import Flask | |
| from flask import Response | |
| from flask import request | |
| import requests | |
| import json | |
| app = Flask(__name__) | |
| @app.route("/") | |
| def hello(): |
| ## Install a necessary packages | |
| $ sudo apt-get install kvm cloud-utils genisoimage | |
| ## URL to most recent cloud image of 12.04 | |
| $ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release" | |
| $ img_url="${img_url}/ubuntu-12.04-server-cloudimg-amd64-disk1.img" | |
| ## download the image | |
| $ wget $img_url -O disk.img.dist | |
| ## Create a file with some user-data in it |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title></title> | |
| </head> | |
| <link rel="stylesheet" type="text/css" href="http://ak0.scstatic.net/1/cdn1.sweetcouch.com/shopify.css"> | |
| <style type="text/css"> | |
| table {width: 100%;font: 12px arial;} | |
| th, td {min-width: 40px;text-align: center;} | |
| th {font-weight: bold;} |
| # Example Dockerfile | |
| FROM hello-world |
| <?php | |
| $webhookContent = ""; | |
| $webhook = fopen('php://input' , 'rb'); | |
| while (!feof($webhook)) { | |
| $webhookContent .= fread($webhook, 4096); | |
| } | |
| fclose($webhook); | |
| echo $webhookContent; |