Skip to content

Instantly share code, notes, and snippets.

View LeonFedotov's full-sized avatar
🐧

Leon Fedotov LeonFedotov

🐧
View GitHub Profile
@LeonFedotov
LeonFedotov / .js
Last active February 20, 2018 16:00
protextme sum hours
Array
.from(table.children)
.filter(({className}) => className == 'data-row')
.map(({children}) => children[7].children[0].innerHTML.trim())
.map((s) => parseFloat(s, 10))
.reduce((a,b) => a+b)
@LeonFedotov
LeonFedotov / print-ali-express.js
Last active May 2, 2019 08:36
Bookmarklet: Print to pdf ali express order page with all the info shown and filename set to "order id - price"
// The way I used it is to open all my orders one by one from the order page
// and then start clicking on this bookmarklet starting from the first order tab
// the bookmarklet changes the title and shows the finance tab
// then launches the print dialog and closes the tab.
javascript:(function () {
document.title = `${window.location.search.split('=').pop()} - ${document.getElementsByClassName('final-price').item(2).innerText}`;
document.getElementById('fund-pnl').style.display = 'block';
document.getElementById('operate-pnl').style.display = 'block';
window.print();
docker network create mongoCluster
docker run -d --rm -p 27017:27017 --name mongo1 --network mongoCluster mongo:latest mongod --replSet myReplicaSet --bind_ip localhost,mongo1
docker run -d --rm -p 27018:27017 --name mongo2 --network mongoCluster mongo:latest mongod --replSet myReplicaSet --bind_ip localhost,mongo2
docker run -d --rm -p 27019:27017 --name mongo3 --network mongoCluster mongo:latest mongod --replSet myReplicaSet --bind_ip localhost,mongo3
docker exec -it mongo1 mongosh --eval "rs.initiate({
_id: \"myReplicaSet\",
members: [
{_id: 0, host: \"mongo1\"},
{_id: 1, host: \"mongo2\"},