Skip to content

Instantly share code, notes, and snippets.

View b3rew's full-sized avatar

b3rew

View GitHub Profile
@b3rew
b3rew / monero-gpu-nvidia.sh
Last active October 21, 2017 12:20
monero-gpu.sh
#!/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"
@b3rew
b3rew / monero.sh
Last active October 18, 2017 14:04
clone monero minner
#!/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"
@b3rew
b3rew / certbot-cron.crontab
Created March 28, 2017 16:43
certbot renewal cron letsencrypt
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
@b3rew
b3rew / default
Created March 13, 2017 07:42
nginx sites-available
server {
listen *:9999;
server_name localhost;
location / {
root /path/to/folder/;
index index.html index.htm;
}
location /api {
@b3rew
b3rew / var_let.js
Created February 15, 2017 13:46
var vs let
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)
@b3rew
b3rew / reduce_for.js
Created February 15, 2017 13:43
reduce vs for loop
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");
@b3rew
b3rew / mongoDB.js
Last active July 14, 2017 06:04
MongoDB query cheetsheet
//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} }
)