This gist is deprecated. Please see http://github.com/sethvargo/hashicorp-installer.
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
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # This script to install Kubernetes will get executed after we have provisioned the box | |
| $script = <<-SCRIPT | |
| # Install kubernetes | |
| apt-get update && apt-get install -y apt-transport-https | |
| curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | |
| cat <<EOF >/etc/apt/sources.list.d/kubernetes.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
| const http = require('http'); | |
| const {promisify} = require('util'); | |
| http.get[promisify.custom] = function getAsync(options) { | |
| return new Promise((resolve, reject) => { | |
| http.get(options, (response) => { | |
| response.end = new Promise((resolve) => response.on('end', resolve)); | |
| resolve(response); | |
| }).on('error', reject); | |
| }); |
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
| module.exports = (string) => { | |
| return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase(); | |
| }; |
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
| // get the original destination for the socket when redirect by linux iptables | |
| // refer to https://raw.githubusercontent.com/missdeer/avege/master/src/inbound/redir/redir_iptables.go | |
| // | |
| const ( | |
| SO_ORIGINAL_DST = 80 | |
| IP6T_SO_ORIGINAL_DST = 80 | |
| ) | |
| func getOriginalDst(clientConn *net.TCPConn) (rawaddr []byte, host string, newTCPConn *net.TCPConn, err error) { | |
| if clientConn == nil { |
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
| package main | |
| import ( | |
| "io/ioutil" | |
| "log" | |
| "os" | |
| "os/user" | |
| "strconv" | |
| ) |
元記事: http://cryto.net/~joepie91/blog/2016/06/13/stop-using-jwt-for-sessions/
Update - June 19, 2016: A lot of people have been suggesting the same "solutions" to the problems below, but none of them are practical. I've published a new post with a slightly sarcastic flowchart - please have a look at it before suggesting a solution.
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
| #!/bin/bash -e | |
| # Setup a Root CA in vault | |
| # Generate and sign an Intermediate cert | |
| # | |
| # Requires: | |
| # * A running vault server already initialzed and unsealed | |
| # * Environment variable VAULT_TOKEN is set | |
| # * vault cli (https://www.vaultproject.io) | |
| # * httpie (https://github.com/jkbrzt/httpie) |
A basic set of systemd units for starting Nginx and PHP-FPM daemons on system startup.
- Ensures Nginx web server has started before the PHP-FPM process.
- Nginx pid file placed at
/run/nginx.pid. - PHP-FPM pid file placed at
/run/php7/php-fpm.pid, PHP7 PHP-FPM config at/etc/php7. - Based on usage with Ubuntu 16.04LTS / 18.04LTS.
Unit files are placed in /etc/systemd/system and enabled with: