Skip to content

Instantly share code, notes, and snippets.

View kenichi's full-sized avatar

Kenichi Nakamura kenichi

  • Portland, Oregon
View GitHub Profile
FROM local_example_php_fpm:latest
COPY --chown=www-data \
example/composer.json \
example/composer.lock \
example/composer.phar \
/var/www/example/
COPY --chown=www-data example/vendor /var/www/example/vendor
location /example {
root /var/www/example/public;
try_files $uri @example;
}
location /_dusk {
root /var/www/app/example/public;
try_files $uri @example;
}
services:
nginx:
volumes:
- ../example:/var/www/example
@kenichi
kenichi / Dockerfile
Created March 29, 2019 21:05
example_php_fpm/Dockerfile
FROM php:7.2-fpm-alpine
# replace www-data(82:82) with www-data(1000:1000)
ARG NAME=www-data
ENV NAME ${NAME}
RUN deluser www-data && \
adduser -s /bin/sh -D -u 1000 -g '' ${NAME} ${NAME} && \
chown -R ${NAME}:${NAME} /home/${NAME}
# needed packages
# TLS terminates at the ALB so force PHP to HTTPS
fastcgi_param REQUEST_SCHEME "https";
fastcgi_param HTTPS "on";
* Trying 2a04:4e42::70...
* TCP_NODELAY set
* Connected to rubygems.org (2a04:4e42::70) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
@kenichi
kenichi / sse.rb
Last active November 1, 2018 17:45
require 'net/http'
require 'set'
require 'uri'
uri = URI.parse 'https://example.com/events'
class ImageSet
def initialize
@set = Set.new
@kenichi
kenichi / test.rb
Created August 17, 2011 22:29
sinatra/haml reload templates
require 'sinatra'
require 'haml'
configure do
set :reload_templates, true
end
get '/' do
haml :index, :layout => false
end
@kenichi
kenichi / index.js
Created February 22, 2018 20:50
express serve partials from outside tree
#!/usr/bin/env node
const app = require('express')();
const viewsDir = __dirname + '/views';
const otherDir = __dirname + '/../ax';
const hbs = require('express-handlebars').create({
defaultLayout: 'main',
layoutsDir: viewsDir + '/layouts',
partialsDir: [
viewsDir + '/partials',
@kenichi
kenichi / grape_middleware_formatter_tracing.rb
Created August 11, 2017 22:10
possible more insight into Grape::Middleware::Formatter
module Grape
module Middleware
class Formatter < Base
include ::NewRelic::Agent::MethodTracer
[ :build_formatted_response,
:fetch_formatter,
:ensure_content_type
].each do |meth|
add_method_tracer :fetch_formatter, "Grape/Middleware/Formatter/#{meth}"