Skip to content

Instantly share code, notes, and snippets.

View fotock's full-sized avatar
🎯
Focusing

Kurt Shian fotock

🎯
Focusing
View GitHub Profile

#Introduction

##Nginx Nginx is a fast and lightweight alternative to the sometimes overbearing Apache 2. However, Nginx just like any kind of server or software must be tuned to help attain optimal performance.

ulimit -l
@fotock
fotock / index.html
Last active August 29, 2015 14:14
A C3.js Line Chart
<!DOCTYPE html>
<meta charset="utf-8">
<link href="http://c3js.org/css/c3-b03125fa.css" rel="stylesheet" type="text/css" />
<body>
<div id="chart" style="margin-top: 30px;"></div>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://c3js.org/js/c3.min-12912fb6.js"></script>
<script>
@fotock
fotock / index.html
Last active August 29, 2015 14:17
Chart.js Practice
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<canvas id="jsChart" width="800" height="400" style="margin:10px 30px;"></canvas>
<script src="https://cdn.rawgit.com/nnnick/Chart.js/master/Chart.js"></script>
<script>
var data = {
labels: ["03-24", "03-25", "03-26", "03-27", "03-28", "03-29", "03-30"],
datasets: [
@fotock
fotock / index.html
Last active August 29, 2015 14:17
Chart.js Bar Chart
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.bar-legend {list-style: none; overflow: auto; margin-left: 17px;}
.bar-legend li {float: left; margin-right: 20px;}
.bar-legend span {display: block; width: 20px; height: 20px; float: left; margin-right: 6px;}
</style>
<body>
<div id="legend"></div>
<canvas id="jsChart" width="800" height="400" style="margin:10px 30px;"></canvas>
@fotock
fotock / index.html
Last active August 29, 2015 14:17
Swift Bubbles in D3.js
<!DOCTYPE html>
<meta charset="utf-8">
<style>
text {font-size: 13px;font-family: Helvetica,Arial,sans-serif; font-weight:100; fill: rgba(255,255,255, .6); transition: .2s; cursor: pointer;}
g:hover text {font-size: 18px; fill: rgba(255,255,255,1)}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var diameter = 960, format = d3.format(",d"), color = d3.scale.category10();
@fotock
fotock / index.html
Last active December 29, 2016 04:58
Aspect Ratio CSS
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.ratio-1-1,.ratio-2-1,.ratio-3-2,.ratio-4-3,.ratio-3-4,.ratio-16-9 {position:relative;overflow:hidden;}
.ratio-1-1:before,.ratio-2-1:before,.ratio-3-2:before,.ratio-4-3:before,.ratio-3-4:before,.ratio-16-9:before {display:block;content:"";width:100%;}
.ratio-1-1>.content,.ratio-2-1>.content,.ratio-3-2>.content,.ratio-4-3>.content,.ratio-3-4>.content,.ratio-16-9>.content {position: absolute;top:0;left:0;right:0;bottom:0;}
.ratio-1-1:before {padding-top:100%;}
.ratio-2-1:before {padding-top:50%;}
.ratio-3-2:before {padding-top:66.67%;}
.ratio-4-3:before {padding-top:75%;}
@fotock
fotock / basic.vim
Created March 21, 2018 13:09
vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic
" http://amix.dk - amix@amix.dk
"
" Version:
" 6.0 - 01/04/17 14:24:34
"
" Blog_post:
" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github
@fotock
fotock / TinyPic.workflow
Created March 19, 2022 07:20
Compress png and jpg.
PATH="$PATH:/usr/local/bin"
LOG=/Users/_________YOUR__HOME___DIR_____/logs/quickcompress.log
for f in "$@"
do
ts=$(perl -MTime::HiRes=time -e 'printf "%d\n", time*1000')
echo "$f begin: " >> $LOG
if [[ "$f" == *.png || "$f" == *.PNG ]] ; then
@fotock
fotock / nginx.conf
Last active March 21, 2024 07:43 — forked from plentz/nginx.conf
Nginx SSL 安全配置最佳实践.
# 生成 dhparam.pem 文件, 在命令行执行任一方法:
# 方法1: 很慢
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# 方法2: 较快
# 与方法1无明显区别. 2048位也足够用, 4096更强
openssl dhparam -dsaparam -out /etc/nginx/ssl/dhparam.pem 4096