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
//update test collection | |
db.test.update({foo: "bar"}, {$set: {test: "success!"}}, {multi: true}) | |
//Find duplicate records by key_name in MongoDB | |
db.collection.aggregate( | |
{"$group" : { "_id": "$key_name", "count": { "$sum": 1 } } }, | |
{"$match": {"_id" :{ "$ne" : null } , "count" : {"$gt": 1} } }, | |
{"$project": {"key_name" : "$_id", "_id" : 0} } | |
) |
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 top = 10000000; | |
var glass = []; | |
var t = 0; | |
var sum = 0; | |
for(var i = 0;i<top;i++){ | |
t += i; | |
glass[glass.length] = {amount: t} | |
} | |
console.time("for time"); |
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 sum = 0; | |
var length = 1000000000; | |
var i = 0; | |
// let j = 0; | |
console.time("let time"); | |
for(let j = 0;j<length;j++){ | |
sum += j; | |
} | |
console.timeEnd("let time"); | |
console.info("let total ", sum) |
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
server { | |
listen *:9999; | |
server_name localhost; | |
location / { | |
root /path/to/folder/; | |
index index.html index.htm; | |
} | |
location /api { |
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
55 23 * * */2 alias sudo='sudo -H' | |
57 23 * * */2 echo "password" | sudo /opt/certbot/certbot-auto renew # don't use this method | |
57 23 * * */2 unalias sudo |
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
#!/usr/bin/env bash | |
project="https://github.com/fireice-uk/xmr-stak-cpu.git" | |
name="monero" | |
cwd=eval echo "~$USER" | |
echo "installing.." | |
sudo apt install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev -y | |
echo "DONE" |
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
#!/usr/bin/env bash | |
project="https://github.com/fireice-uk/xmr-stak-nvidia" | |
name="monero" | |
cwd=eval echo "~$USER" | |
echo "installing.." | |
sudo apt-get install nvidia-cuda-dev nvidia-cuda-toolkit libmicrohttpd-dev libssl-dev cmake cmake-curses-gui build-essential -y | |
echo "DONE" |