curl https://raw.githubusercontent.com/infinimesh/kaf/master/godownloader.sh | BINDIR=$HOME/bin bash
kaf config add-cluster local -b localhost:9092
kaf config select-cluster
bin/zookeeper-server-start.sh config/zookeeper.properties
/** | |
* This script types for you automatically on www.typingclub.com: | |
* 1. Open the website | |
* 2. Blaze past the tutorials | |
* 3. Go into a level | |
* 4. Open Console | |
* 5. Paste the script and press ENTER | |
*/ | |
// NOTE: When delay (in ms between two strokes) is too low, the site might bug out and the result page will not be shown |
# 若安装包里自带卸载删不干净可以用以下命令 | |
rm -rf /Library/Input\ Methods/SogouInput.app | |
rm -rf $HOME/Library/Caches/SogouServices | |
rm -rf $HOME/.sogouinput |
# Translates Markdown syntax to Slack, replaces: | |
# | |
# - hyphened lists with bullet symbols | |
# - double bold marker asterisks `**` with single asterisk `*` | |
# - headers `#` with bold marker asterisks `*` | |
# | |
# Run with | |
# | |
# python markdown-to-slack.py filename.md | |
# |
const csvStringToArray = (strData, header=true) => | |
{ | |
//const objPattern = new RegExp(("(\\,|\\r?\\n|\\r|^)(?:\"([^\"]*(?:\"\"[^\"]*)*)\"|([^\\,\\r\\n]*))"),"gi"); | |
const objPattern = new RegExp(("(\\,|\\r?\\n|\\r|^)(?:\"((?:\\\\.|\"\"|[^\\\\\"])*)\"|([^\\,\"\\r\\n]*))"),"gi"); | |
let arrMatches = null, arrData = [[]]; | |
while (arrMatches = objPattern.exec(strData)){ | |
if (arrMatches[1].length && arrMatches[1] !== ",") arrData.push([]); | |
arrData[arrData.length - 1].push(arrMatches[2] ? | |
arrMatches[2].replace(new RegExp( "[\\\\\"](.)", "g" ), '$1') : | |
arrMatches[3]); |
# Ruby經典面試題目 Q1. 什麼是類別?What is a Class? | |
# 物件導向程式語言利用「可重複性」的概念,例如繼承(inheritance)來使軟體功能更易於維護。 | |
class World | |
end | |
#Country繼承World | |
class Country < World | |
end |
I am passionate about Ruby, but its execution time compared to other languages is extremely high, especially when we want to use more complex algorithms. In general, data structures in interpreted languages become incredibly slow compared to compiled languages. Some algorithms such as ´n-body´ and ´fannkuch-redux´ can be up to 30 times slower in Ruby than Go. This is one of the reasons I was interested in embedding Go code in a Ruby environment.
For those who do not know how shared libraries operate, they work in a similar way as DLLs in Windows. However, they have a native code with a direct interface to the C compiler.
Note Windows uses the DLL system, and in this case, this does not necessarily have to be in native code.
One example is DLLs written in C#, which runs on a virtual machine. Because I do not use windows, I ended up not testing if it is poss
//This is an O(n) algorithm (linear) | |
Given an array A, of size n: | |
1. Pick a random index, p, as the pivot | |
2. Iterate through the array, comparing every element e to p, and counting the total number of elements before p | |
a. if e < p, move e to the left of p | |
b. if e > p, move e to the right of p | |
c. if e == p, leave e where it is | |
3. count the number of elements before p |