Install Multiple Python Versions for Specific Project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' | |
always getting the most recent frame of a camera | |
================================================ | |
Usage: | |
------ | |
freshest_camera_frame.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<Object> shuffleList(List<Object> list) { | |
Random rand = new Random(); | |
// convert to array | |
Object[] array = list.toArray(); | |
for (int i = array.length - 1; i > 0; i--) { | |
// generate random number in range 0 to i | |
int j = rand.nextInt(i + 1); | |
// swap array[i] with array[j] | |
Object temp = array[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
After install zsh | |
- brew update | |
- brew install nvm | |
- mkdir ~/.nvm | |
after in your ~/.zshrc or in .bash_profile if your use bash shell: | |
export NVM_DIR=~/.nvm | |
source $(brew --prefix nvm)/nvm.sh |
Moved to git-repository: https://github.com/denji/awesome-http-benchmark
Located in alphabetical order (not prefer)
- ab – slow and single threaded, written in
C
- apib – most of the features of ApacheBench (
ab
), also designed as a more modern replacement, written inC
- autocannon – fast HTTP/1.1 benchmarking tool written in Node.js
- baloo – Expressive end-to-end HTTP API testing made easy, written in Go (
golang
)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const io = require('socket.io-client'); | |
const socket = io('http://localhost:3000', { | |
transportOptions: { | |
polling: { | |
extraHeaders: { | |
'Authorization': 'Bearer abc', | |
}, | |
}, | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Jupyter Notebook | |
[Service] | |
Type=simple | |
ExecStart=/home/roeyd/Notebook/.env/bin/jupyter lab --port 9090 | |
WorkingDirectory=/home/roeyd/Notebook | |
[Install] | |
WantedBy=default.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# so that you can open with excel | |
def addUTF8Bom(filename): | |
f = codecs.open(filename, 'r', 'utf-8') | |
content = f.read() | |
f.close() | |
f2 = codecs.open(filename, 'w', 'utf-8') | |
f2.write(u'\ufeff') | |
f2.write(content) | |
f2.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example, we want to sort list of objects based on an object's attribute. ex: "age" | |
var peopleList = [{"name": "Laura", "age":5}, {"name": "Peppa", "age": 40}, {"name": "Josh", "age":22}]; | |
var comparision = function(a, b) { return a.age > b.age ? 1 : -1; }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
type | |
, count(*) | |
, count(DISTINCT u) | |
, count(CASE WHEN plat=1 THEN u ELSE NULL END) | |
, count(DISTINCT CASE WHEN plat=1 THEN u ELSE NULL END) | |
, count(CASE WHEN (type=2 OR type=6) THEN u ELSE NULL END) | |
, count(DISTINCT CASE WHEN (type=2 OR type=6) THEN u ELSE NULL END) | |
FROM | |
t |
NewerOlder