Skip to content

Instantly share code, notes, and snippets.

@dfang
dfang / gist:f71d414b461b6ff77d7d070c16c9930a
Last active October 10, 2020 18:27
build nginx with ngx_pagespeed and http2 support on ubuntu 14.04

Test your web server for HTTP/2 and ALPN support KeyCDN

Test SSL strength of your setup SSL LABS

install openssl with ALPN support

chrome 51 dropped HTTP/2 via NPN
we need to support HTTP/2 via ALPN, however... on Ubuntu 14.04
NGINX has been compiled with OpenSSL 1.0.1 which does not support ALPN
so upgrade OpenSSL to 1.0.2

PATH=$PATH:`yarn global bin`
alias gs='git status'
alias ga='git add'
alias gd='git diff'
alias gdc='git diff --cached'
alias gb='git branch'
alias gba='git branch --all'
alias g='git'
alias y='yarn'
@dfang
dfang / gist:ca8a6c96c9bc4a4e8ee1e930267d1a3a
Created August 11, 2017 08:32
compile nginx with pagespeed dynamic module support
NPS_VERSION=1.12.34.2-stable
NPS_RELEASE_NUMBER=${NPS_VERSION/stable/}
sudo apt-get update \
&& sudo apt-get install -y unzip \
&& sudo apt-get build-dep nginx=1.13.3 \
&& cd \
&& apt-get source nginx=1.13.3 \
&& cd \
&& wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}.zip \
@dfang
dfang / Untitled-6
Last active July 18, 2019 03:07
partner.dhc.jd.com 京东大家电
orderSummary.js
@dfang
dfang / postgres-upgrade-recipe.sh
Created March 14, 2017 05:00 — forked from chrismccord/postgres-upgrade-recipe.sh
Upgrade Postgres to 9.4 using Homebrew on Mac OSX
#!/bin/bash
# This script can be used in "run & hope" mode or you can use it as a recipe to
# do things manually - you probably want the latter if you really care about
# the data in your databases.
# Happy hacking
# /Eoin/
# Tell bash to stop if something goes wrong
set -e
@dfang
dfang / homebrew-postgres-9.6-upgrade.sh
Created March 14, 2017 03:47 — forked from matthewlehner/homebrew-postgres-9.6-upgrade.sh
Upgrades Homebrew Postgres installation from 9.5 to 9.6
brew services stop postgresql
initdb /usr/local/var/postgres9.6 -E utf8
pg_upgrade -d /usr/local/var/postgres -D /usr/local/var/postgres9.6 -b /usr/local/Cellar/postgresql/9.5.5/bin -B /usr/local/Cellar/postgresql/9.6.1/bin -v
mv /usr/local/var/postgres /usr/local/var/postgres9.5
mv /usr/local/var/postgres9.6 /usr/local/var/postgres
brew services start postgresql
@dfang
dfang / app_index.html
Last active January 7, 2017 06:06
webpack-dev-server weird bug, --hot and --inline option order matters ?
<html>
<head>
<title>Webpack HMR demo</title>
</head>
<body>
<script src="bundle.js"></script>
</body>
</html>
this is settings backed up by atom sync-settings package
@dfang
dfang / ENV and ARG
Last active May 8, 2016 16:41
Dockfile
```Dockerfile
FROM busybox
ARG EXPOSED_PORTS
ENV EXPOSED_PORTS ${EXPOSED_PORTS:-20000}
RUN echo ${EXPOSED_PORTS}
EXPOSE ${EXPOSED_PORTS}
```
这种写法也可以不传 --build-arg
docker build -t test .
@dfang
dfang / gist:c463f3420a801480b1c8041372889a1f
Last active April 28, 2016 04:27
install python 2.7.9 on ubuntu 14.04
for odoo, python 2.7.9 is best
https://www.odoo.com/documentation/8.0/setup/install.html#setup-install-source
https://www.v2ex.com/t/260379
https://profcollab.wordpress.com/2015/06/02/%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82-%D0%BC%D0%B8%D1%80/
https://renoirboulanger.com/blog/2015/04/upgrade-python-2-7-9-ubuntu-14-04-lts-making-deb-package/
https://github.com/yyuu/pyenv
https://www.python.org/ftp/python/2.7.9/