Skip to content

Instantly share code, notes, and snippets.

View huhongbo's full-sized avatar

huhongbo huhongbo

  • Hangzhou,Zhejiang,China
View GitHub Profile
@huhongbo
huhongbo / countries.json
Created January 13, 2023 02:03 — forked from jacobbubu/countries.json
Chinese country names and their ISO code
[
{
"ISO2": "AD",
"ISO3": "AND",
"DIGITS": "20",
"ISO-3166-2": "ISO 3166-2:AD",
"English": " Andorra",
"China": "安道尔",
"Taiwan": "安道爾",
"Hongkong": "安道爾",
# /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="ieee80211", ACTION=="add|change", ATTR{macaddress}=="b8:27:eb:ff:ff:ff", KERNEL=="phy0", \
RUN+="/sbin/iw phy phy0 interface add ap0 type __ap", \
RUN+="/bin/ip link set ap0 address b8:27:eb:ff:ff:ff"
@huhongbo
huhongbo / ga.js
Created May 15, 2020 06:27 — forked from Asikur22/ga.js
GA Scripts #GA
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
// For analytics.js
<script>
jQuery( document ).ready(function($) {
jQuery('a[href^="tel:"]').on('click', function() {
var n = jQuery(this).attr('href').replace('tel:', '');
ga('send', 'event', 'Phone Click Tracking', n, 'Click to Call', n);
});
jQuery('a[href^="mailto:"]').on('click', function() {
@huhongbo
huhongbo / letsencrypt_2017.md
Created March 13, 2018 12:13 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@huhongbo
huhongbo / setup_radsrv_mysql.sh
Created December 25, 2017 02:49 — forked from xjdrew/setup_radsrv_mysql.sh
setup radius server using mysql
#!/bin/bash
#
MYSQL_HOST=127.0.0.1
MYSQL_PORT=3306
MYSQL_ROOT_PWD=mysql123
# 数据库名字默认为radius,建议不改
MYSQL_RADIUS_USER=freeradius
MYSQL_RADIUS_PWD=freeradius123
@huhongbo
huhongbo / ss-redir 透明代理.md
Created November 20, 2015 09:21 — forked from wen-long/ss-redir 透明代理.md
ss-redir 透明代理.md

##ss-redir 的 iptables 配置(透明代理)

透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则

创建 /etc/ss-redir.json 本地监听 7777 运行ss-redir -v -c /etc/ss-redir.json

iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
# Chef configuration snippet
#
# Uses the following parameters:
# - chef-validation-key: PEM-formatted validation key
# - chef-url: URL to the Chef server, e.g. https://chef.example.com
# - chef-runlist: comma-separated runlist, e.g. role[bootstrap],role[base]
# - chef: when 'true', runs this snippet
<% if @host.param_true?('chef') %>
curl -L https://www.opscode.com/chef/install.sh | bash
@huhongbo
huhongbo / client side
Last active August 29, 2015 14:07 — forked from piavlo/client side
/etc/sensu/conf.d/checks/thresholds/logstash-elasticsearch.json
{
"client": {
"params": {
"cpu": {
"warning": 80,
"critical": 90
},
"iowait": {
<style type="text/css">
#dashboard_list ul {
margin:20px, 40px, 40px, 10px;
overflow:hidden;
}
#dashboard_list li {
line-height:1.5em;
float:left;
display:inline;
}
(graphite-server
:port 2002
:host "0.0.0.0"
:parser-fn (fn [{:keys [service] :as event}]
(if-let [[src host service & tags]
(clojure.string/split service #"\.")]
{:host (clojure.string/replace host #"_" ".")
:service (clojure.string/join "." (concat [service] tags))
:tags (concat tags ["graphite" src service])})))