Skip to content

Instantly share code, notes, and snippets.

View qiaohaijun's full-sized avatar
🎯
Focusing

qiao hai-jun qiaohaijun

🎯
Focusing
  • Beijing,China
View GitHub Profile
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@marcusking01
marcusking01 / install-spark-shark-1.1.0.rb
Last active December 6, 2022 21:38
Ruby script for EMR clusters using hadoop 2.4 to bootstrap Spark 1.1.0
#!/usr/bin/ruby
require 'json'
require 'emr/common'
require 'digest'
require 'socket'
def run(cmd)
if ! system(cmd) then
raise "Command failed: #{cmd}"
@sing1ee
sing1ee / gist:5971946
Last active March 27, 2024 06:37
Google面试题:扔鸡蛋问题

Google面试题:扔鸡蛋问题

原题描述

两个软硬程度一样但未知的鸡蛋,它们有可能都在一楼就摔碎,也可能从一百层楼摔下来没事。有座100层的建筑,要你用这两个鸡蛋通过最少的次数确定哪一层是鸡蛋可以安全落下的最高位置。可以摔碎两个鸡蛋

方法分析

看到这个题目,最保险的方法就是一层一层试验,但这样只需要一个鸡蛋就可以了。我们现在有两个鸡蛋,完全可以用有更快的方法。

@larsks
larsks / gist:4988914
Last active December 22, 2016 12:29

We were discussing the design of an HA environment for Puppet, and what the potential impacts were of a "split-brain" situation. For the model that I was discussing...

HA puppet architecture

...the "worst case" scenario is probably that the two Postgres databases become out-of-sync. This would require a network interruption that would cause:

  • the two front-end Puppet masters to lose contact with each other, causing both assume the master role, with the result that pgpool would be running on both nodes and each puppetdb process would be talking to it's local pgpool instance.
  • pgpool on one of the nodes to lose contact with the current master database server, causing it to erroneously promote the slave database.
  • some puppet clients in the environment to see one master and others to see the other master
@qiaohaijun
qiaohaijun / mg.csv
Created January 10, 2013 06:17 — forked from nanxstats/mg.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 7 columns, instead of 6. in line 9.
1.1335086e+00, 1.0653587e+00, 8.4250325e-01, 7.0782984e-01, 1.0178784e+00, 1.2476827e+00, 9.0000000e-01
1.1645714e+00, 1.1355961e+00, 5.5885374e-01, 7.9370192e-01, 1.0346794e+00, 1.0067861e+00, 9.0000000e-01
1.0315895e+00, 1.1533842e+00, 4.2572016e-01, 1.0558440e+00, 1.1640420e+00, 7.1297054e-01, 9.0000000e-01
7.9058261e-01, 1.0678134e+00, 7.5043060e-01, 1.2000510e+00, 1.0670009e+00, 5.0349420e-01, 9.4136145e-01
6.3878936e-01, 8.1349649e-01, 9.7291951e-01, 1.2998549e+00, 1.0026658e+00, 5.8392542e-01, 1.1188041e+00
6.4385427e-01, 6.6246660e-01, 9.3785503e-01, 1.1857500e+00, 7.7000347e-01, 9.4327347e-01, 1.2161867e+00
9.7290237e-01, 6.2210481e-01, 1.0653587e+00, 8.4250325e-01, 7.0782984e-01, 1.0178784e+00, 1.2476827e+00
1.1330941e+00, 9.3890430e-01, 1.1355961e+00, 5.5885374e-01, 7.9370192e-01, 1.0346794e+00, 1.0067861e+00
1.1738960e+00, 1.1287058e+00, 1.1533842e+00, 4.2572016e-01, 1.0558440e+00, 1.1640420e+00, 7.1297054e-01
1.2210669e+00, 1.1699535e+00, 1.0678134e+00, 7.5043060e-01, 1.2000510e+00, 1.0670009e+00
@josevalim
josevalim / 0_README.markdown
Created January 9, 2012 13:07
Hello world of Sinatra-like libraries on Elixir, Ruby and Node.js
@yohm
yohm / zsh_ignore_case
Created April 29, 2011 03:47
ignore case completion for zsh
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}'