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
#!/bin/env python | |
import urllib2 | |
import json | |
opener = urllib2.build_opener() | |
opener.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0')] | |
rawdata = opener.open('https://cex.io/api/ticker/BTC/USD') | |
data = rawdata.read() |
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
#!/bin/env python | |
import calendar | |
import datetime | |
now = datetime.datetime.now() | |
cal = calendar.Calendar() | |
working_days = len([x for x in cal.itermonthdays2(now.year, now.month) if x[0] !=0 and x[1] < 5]) |
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
#!/bin/env python | |
import calendar | |
import datetime | |
now = datetime.datetime.now() | |
cal = calendar.Calendar() | |
total_sunday = len([x for x in cal.itermonthdays2(now.year, now.month) if x[0] != 0 and x[1] == 6]) |
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
#!/bin/env python | |
import sys | |
input=int(sys.argv[1])+1 | |
array=range(1,input) | |
print array | |
def remove_left(myarray): |
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
#!/bin/bash | |
curl "https://www.e-solat.gov.my/index.php?r=esolatApi/TakwimSolat&period=today&zone=SGR01" 2>/dev/null| sed 's/,/,\n/g' | egrep 'imsak|fajr|syuruk|dhuhr|asr|maghrib|isha' | tr -dc '[:alnum:]\n:' | sed 's/:/ /' |
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
#!/bin/bash | |
ps2pdf -sPAPERSIZE=a4 -dFIXEDMEDIA -dPDFFitPage input.pdf output.pdf |
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
#!/bin/env python3 | |
import calendar | |
import datetime | |
now = datetime.datetime.now() | |
cal = calendar.Calendar() | |
month = 1 |
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
aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" | jq '.Reservations[]|.Instances[]|{InstanceId,PrivateIpAddress,Name: .Tags[]|select(.Key == "Name").Value}' |
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
aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" | jq '.Reservations[]|.Instances[]|{InstanceId,PrivateIpAddress,Name: .Tags[]|select(.Key == "Name").Value}' | jq -n '[inputs]|sort_by(.Name)' |
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
aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" | jq '[.Reservations[]|.Instances[]|{Name: .Tags[]|select(.Key == "Name").Value,DeviceName: [.BlockDeviceMappings[]|.DeviceName]}]|sort_by(.Name)' ec2.json |
OlderNewer