Skip to content

Instantly share code, notes, and snippets.

View fire9's full-sized avatar
🏠
Working from home

fire9 fire9

🏠
Working from home
View GitHub Profile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@paulswartz
paulswartz / ssl_proxy.config
Created October 14, 2014 18:01
SSL Forwarding Proxy w/ nginx
# run as 'nginx -p . -c ssl_proxy.config'
daemon off;
http {
server {
listen localhost:8443;
server_name localhost;
ssl on;
ssl_certificate ../pooling-ui/certs/server.crt;
--[[ config
root = "./"
listen = "127.0.0.1:8786"
redisaddr = "127.0.0.1:6379[1]"
dbfile = root .. "backup.db"
thread = 4
logger = nil
harbor = 1
require "net/https"
require "uri"
require 'json'
uri = URI.parse("https://www.howsmyssl.com/a/check")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
resp = JSON.parse(http.request(Net::HTTP::Get.new(uri.request_uri)).body)
puts JSON.pretty_generate(resp)
@hgfischer
hgfischer / benchmark+go+nginx.md
Last active April 11, 2024 22:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@plentz
plentz / nginx.conf
Last active May 17, 2024 09:08
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@fcicq
fcicq / cgmonitor.py
Last active December 13, 2015 21:18
cgminer monitor (use with cgminer 2.10+, please enable --api-listen --api-allow first)
# by fcicq <fcicq@fcicq.net> on 2013.2.18, Released under GPLv3
import socket
import urlparse
import urllib
import time
import math
CONV_4G = 4295.0 # 4096 or 4295
CONV_60_SHARE = CONV_4G / 60.0 # 4096 / 60 = 68.27 or 4295 / 60 = 71.58
@raggi
raggi / validate_local_cache.sh
Last active December 11, 2015 23:39
A script to validate your local gem cache against the public s3 repositories. If you find mismatches that contain both local and remote values, please post them in comments.
#!/usr/bin/env sh
if ! which md5sum > /dev/null; then
echo Install md5sum
exit 1
fi
if ! which curl > /dev/null; then
echo Install curl
exit 1
@xumingming
xumingming / how-ring-autoload-works.sh
Last active December 11, 2015 17:08
How ring's autoload works?
<rationalrevolt> With ring, can some one help me understand why passing a var
to run-jetty allows me to reload code and have it reflect
immediately? (run-jetty #'handler {:port 8080 :join? false})
[12:58]
<nDuff> rationalrevolt: passing the var object means it's involved in the
lookup, and can be substituted/replaced. [12:59]
*** bobbrahms1 (~Adium@pool-71-251-206-14.nwrknj.fios.verizon.net) has joined
channel #clojure [13:01]
*** bobbrahms (~Adium@pool-71-251-206-14.nwrknj.fios.verizon.net) has quit:
Read error: Connection reset by peer
@fcicq
fcicq / smartmachine-survival-guide-fcicq.markdown
Last active December 11, 2015 06:48
SmartMachine 生存指南 by fcicq

SmartMachine 生存指南

by fcicq, CC-BY

SmartMachine 是 Joyent 家的虚拟化方案.
SmartOS 主要的卖点是 ZFS + DTrace + Zones (SmartMachine) + KVM (运行 Linux, Windows 等).
实际上 SmartOS 是 Joyent 以 Solaris 为基础 (因为 OpenSolaris 项目被中止而改名 illumos) 打包的操作系统.

SmartOS 作为 HOST 时, 虽然支持 KVM 虚拟化, 但不支持突发的 vCPU.
而 SmartMachine 是基于 Zones 的 (存储则是 ZFS), 比较类似 Linux 平台下 OpenVZ 或者 LXC 的方案.
资源用量由调度器决定, 只需要修改配额 (ZFS 也支持在线扩展) 就可以伸缩, 所以伸缩不需要重启.