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
#!/bin/sh | |
percent_allowed=85 | |
memory_too_high(){ | |
MAXMEM=$(free -m | grep -oP '\d+' | head -n 1) #total available memory | |
USEDMEM=$(free -m | awk 'NR==2{printf "%s", $3,$2,$3*100/$2 }') # memory used | |
PERCENTAGE=$(echo "scale=8; ($USEDMEM / $MAXMEM) * 100" | bc) # get percentage | |
P_INT=${PERCENTAGE%.*} # convert from float to int |
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
var redis = require('redis'); | |
var client = redis.createClient(); //redis.createClient(port, host, options) | |
const key = 'test'; //redis key name | |
//Error handling | |
client.on("error", (err) => { | |
console.log(`Error: ${err}`); | |
}); |
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
Traceback (most recent call last): | |
File "/usr/local/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 3078, in get_loc | |
return self._engine.get_loc(key) | |
File "pandas/_libs/index.pyx", line 140, in pandas._libs.index.IndexEngine.get_loc | |
File "pandas/_libs/index.pyx", line 162, in pandas._libs.index.IndexEngine.get_loc | |
File "pandas/_libs/hashtable_class_helper.pxi", line 1492, in pandas._libs.hashtable.PyObjectHashTable.get_item | |
File "pandas/_libs/hashtable_class_helper.pxi", line 1500, in pandas._libs.hashtable.PyObjectHashTable.get_item | |
KeyError: 'Open' | |
During handling of the above exception, another exception occurred: |
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 CoinbasePro = require('coinbase-pro'); | |
const subscriptions = ['BTC-USD', 'ETH-EUR']; | |
let groups = {}; | |
let beat = {}; | |
startCoinbaseSocket = (subscriptions, groupid) => { | |
let websocket = new CoinbasePro.WebsocketClient( | |
subscriptions, | |
'wss://ws-feed.pro.coinbase.com', | |
{ |
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
/* | |
Created with refrence from | |
https://gist.github.com/binki/52662f18ae6fc89b18b020b89aa4e1cd | |
http://www.madhur.co.in/blog/2016/09/05/nodejs-connection-pooling.html | |
*/ | |
const mysql = require('mysql'); // import | |
const pool = mysql.createPool({ // create pool instance | |
host: "*", | |
user: "*", |