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
import tweepy | |
import csv | |
import time | |
consumer_key = 'xxxxxx' | |
consumer_secret = 'xxxxxx' | |
access_token = 'xxxx-xxxxxxxxxxx' | |
access_token_secret = 'xxxxxxxxx' | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) |
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
redis-cli --no-auth-warning json.get KEY:EXAMPLE | sed 's/\\//g' | sed 's/"$//g' | sed 's/^"//g' | sed 's/..$//g' |
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
import re | |
def extract_strike_from_symbol(symbol, underlying_price): | |
strike = re.findall('[\d\.]+', symbol)[0].strip('.') | |
if len(strike) > 4 and '.' not in strike: | |
s1 = float(strike[:4] + '.' + strike[4:]) | |
s2 = float(strike[:3] + '.' + strike[3:]) | |
diff1 = abs((float(underlying_price) / s1 - 1) * 100) | |
diff2 = abs((float(underlying_price) / s2 - 1) * 100) | |
strike = s1 if diff1 < diff2 else s2 |
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 ps -q | xargs -n 1 docker inspect --format '{{.Name}}\TAB{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}\TAB{{range $p, $conf := .NetworkSettings.Ports}}{{$p}} {{end}}' | sed 's/\///' | column -t -s '\TAB' | |
postgres11-main 172.18.0.4 5432/tcp | |
mysql-main 172.18.0.2 3306/tcp 33060/tcp | |
postgres9.6-main 172.18.0.3 5432/tcp |