This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # This is assumed to be run as root or with sudo | |
| export DEBIAN_FRONTEND=noninteractive | |
| # Import MySQL 5.7 Key | |
| # gpg: key 5072E1F5: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" imported | |
| apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 5072E1F5 | |
| echo "deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7" | tee -a /etc/apt/sources.list.d/mysql.list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Import fs (filesystem) | |
| var chmodSync = require('fs').chmodSync; | |
| // Import execFile, to run our bash script | |
| var execFile = require('child_process').execFile; | |
| chmodSync('./build.sh', 0755); | |
| var execOptions = { | |
| maxBuffer: 1024 * 1024 * 5 // Increase max buffer to 5mb | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| ROOT_USER_PASS='root' | |
| sudo apt-get update | |
| sudo apt-get install -y vim curl tmux wget unzip zip htop | |
| sudo apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 | |
| sudo cat > /etc/apt/sources.list.d/mysql.list <<EOL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "_index": "http-access-2015.08.28", | |
| "_type": "fluentd", | |
| "_id": "AU91sX8H3fvMhMs_8892", | |
| "_score": null, | |
| "_source": { | |
| "remote": "45.55.237.56", | |
| "host": "-", | |
| "user": "-", | |
| "method": "\\x16\\x03\\x01\\x010\\x01\\x00\\x01,\\x03\\x03\\x18\\x1B\\x85\\xAA\\x81\\xA7\\x91\\x1F\\xDA\\xCA1rg+\\xB0\\x1F\\x94\\xF3\\xE9\\x03\\xB5\\x80$g*\\x18\\xEFeAv\\xDES\\x00\\x00\\x96\\xC00\\xC0,\\xC0(\\xC0$\\xC0\\x14\\xC0", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <VirtualHost *:80> | |
| ServerName site.example.com | |
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteCond %{HTTPS} !=on | |
| RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
| </IfModule> | |
| </VirtualHost> | |
| <VirtualHost *:443> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| # ... | |
| # Redirect /book and any sub-uris | |
| # e.g. /book/anything | |
| # e.v. /book/whatever?maybe=a_query_too | |
| location /book { | |
| return 301 http://book.serversforhackers.com; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print "This is whatever" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import base64 | |
| import json | |
| from Crypto.Cipher import AES | |
| from phpserialize import loads | |
| def decrypt(payload): | |
| data = json.loads(base64.b64decode(payload)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fastcgi_cache_path /tmp/cache levels=1:2 keys_zone=images:100m inactive=60m; | |
| fastcgi_cache_key "$scheme$request_method$host$request_uri"; | |
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server ipv6only=on; | |
| #root /usr/share/nginx/html; | |
| root /var/www/html; | |
| index index.html index.htm; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sql_query = SELECT topic_id, topic FROM topics | |
| # joined/payload field fetch query | |
| # joined fields let you avoid (slow) JOIN and GROUP_CONCAT | |
| # payload fields let you attach custom per-keyword values (eg. for ranking) | |
| sql_joined_field = post from query; \ | |
| SELECT topic_id, post \ | |
| FROM posts \ | |
| ORDER BY topic_id ASC |