This file contains 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
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\"}, |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<script id="lol"> | |
;eval(document.getElementById('lol').innerHTML.split(';').shift().replace(/\n/g, '').replace(/ /g, '0').replace(/\t/g, '1').replace(/[01]{8}/g, function(bin) {return String.fromCharCode(parseInt(bin, 2));})); | |
</script> | |
</body> |
This file contains 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
// 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(); |
This file contains 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
(function() { | |
var all = $('.block-grid.five-up > li').toArray(); | |
all.slice(5).forEach(function(current, index) { | |
index += 5; | |
var el = $(current), | |
offset = el.offset(), | |
above = $(all[index-5]); | |
el.css({ | |
position: 'relative', |
This file contains 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
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) |
This file contains 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 map = (a, b, c, d) => (x) => (x-a)/(b-a) * (d-c) + c | |
const sigmoid = (x) => 1 / (1 + Math.exp(-x)) | |
const nuron = (weights = [], bias = 0, ...inputs) => sigmoid( | |
inputs | |
.map((input, index) => input*weights[index]) | |
.reduce(((sum, current) => sum+current), bias) | |
) |
This file contains 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
________ | |
< Hello! > | |
-------- | |
\ ^__^ | |
\ (oo)\_______ | |
(__)\ )\/\ | |
||----w | | |
|| || |
This file contains 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
var surroundWithOverlay = function(target) { | |
var $t = $(target), | |
offsets = $t.offset(), | |
height = $t.height(), | |
width = $t.width(), | |
clearUs = function() { $('.overlayDivs').remove(); }; | |
$('<div class="overlayDivs">').css({ | |
/* |
This file contains 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
(function(){ | |
//jasmine "it" function fix for async, adding another parameter to support promises and augment waitsFor. | |
var generate_promise = function() { | |
var promise = { | |
check_for: false, | |
waits: function() { | |
waitsFor(function() { | |
return promise.check_for; | |
}); | |
}, |
This file contains 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
COFFEE_EXEC = '/Users/leon/code/resources/CoffeeScriptRedux/bin/coffee' #https://github.com/michaelficarra/CoffeeScriptRedux/ | |
def create_js(source) | |
target = "#{File.dirname(source)}/js/#{File.basename(source, '.coffee')}.js" | |
puts "#{COFFEE_EXEC} --js -i #{source} > #{target}" | |
%x{#{COFFEE_EXEC} --js -i #{source} > #{target}} | |
puts "#{COFFEE_EXEC} --source-map -i #{source} > #{target}.map" | |
%x{#{COFFEE_EXEC} --source-map -i #{source} > #{target}.map} |
NewerOlder