Skip to content

Instantly share code, notes, and snippets.

View jakubriedl's full-sized avatar

Jakub Riedl jakubriedl

View GitHub Profile
@jakubriedl
jakubriedl / api.example.com.conf
Created May 19, 2014 07:54
nginx + laravel API vhost
server {
listen 443 ssl;
server_name api.example.com;
root /var/www/api/public/;
index index.php index.html index.htm;
### Begin SSL
ssl_certificate /etc/ssl/custom/api.example.com.crt;
ssl_certificate_key /etc/ssl/custom/api.example.com.key;
@jakubriedl
jakubriedl / terminator.conf
Created May 19, 2014 07:56
nginx SSL terminator for varnish
server {
listen 443 ssl;
server_name api.example.com;
ssl_certificate /etc/ssl/custom/api.example.com.crt;
ssl_certificate_key /etc/ssl/custom/api.example.com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
@jakubriedl
jakubriedl / flow.md
Last active August 29, 2015 14:14
Concept of new development and deploy flow

Concept of development and deploy flow

  • based on github flow
  • promotes devOps
  • covers all parts of Deming Cycle
  • 4 eyes rule - every task result is seen by at least 4 eyes before deployment

Benefits of this flow

  • smaller releases
@jakubriedl
jakubriedl / sql.md
Last active August 29, 2015 14:17
Composite Types in Postgres

Price

Create custom type

CREATE TYPE price AS ("amount" float, "currency" char(3));
CREATE TYPE vat AS ("base" float, "amount" float, "rate" smallint);

Use the type in table column

@jakubriedl
jakubriedl / file.sh
Created August 31, 2015 09:14
show stats of all running containers
docker ps | awk '{print $1}' | sed -n -e '/[^CONTAINER]/p' | xargs docker stats
@jakubriedl
jakubriedl / nginx-server
Created March 4, 2016 15:50
Nginx reverse proxy conf
location / {
proxy_set_header Host arrivacz-custom.bileto.com;
proxy_ssl_verify off;
proxy_ssl_session_reuse off;
proxy_ssl_server_name on;
proxy_pass https://arrivacz-custom.bileto.com;
# try_files $uri $uri/ =404;
@jakubriedl
jakubriedl / script.sh
Last active October 7, 2017 01:36
Git lines per author
# Authors
git ls-files | grep "yarn.lock" -v | grep "package-lock.json" -v | while read f; do git blame --line-porcelain $f | grep '^author '; done | sort -f | uniq -ic | sort -n
# Size of repository
git ls-files | grep "yarn.lock" -v | grep "package-lock.json" -v | while read f; do git blame --line-porcelain $f | grep '^author '; done | wc -l
@jakubriedl
jakubriedl / jwtToken.js
Last active September 29, 2017 11:20
JWT oidc tokens
// Simplified version how we inject JWT AccessToken into panva/oidc-provider
const provider = new Provider(...)
function getTokenData () {
const authorization = _.get(this, 'claims._authorization', {})
return {
...authorization,
...(_.omit(this, ['claims']))
}
@jakubriedl
jakubriedl / config.js
Created March 25, 2018 23:38
Apollo cache nesting patch
import {patchApolloHints} from './patchApollo'
const apolloConfig = {
formatResponse: (response, options) => {
patchApolloHints(response)
// and some more stuff
},
cacheControl: true
}
@jakubriedl
jakubriedl / npm-install-force.sh
Created February 4, 2019 06:20
Force install npm outdated dependencies
npm outdated | awk '{if (NR!=1) {print $1 "@latest"}}' | xargs npm i