Skip to content

Instantly share code, notes, and snippets.

View 0xankit's full-sized avatar
🎯
Focusing

Ankit Kumar 0xankit

🎯
Focusing
View GitHub Profile
@avamsi
avamsi / irctc.py
Last active July 28, 2024 14:33
Python script to semi-automate tatkal ticket booking.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select, WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from time import sleep, strftime
def waituntil(s):
while strftime('%H:%M:%S') < s:
print strftime('%H:%M:%S')
sleep(1)
@ianklatzco
ianklatzco / discord-bot-post-message.sh
Created December 29, 2016 02:36
sends a message to a discord channel via a bot using command line HTTP POST- curl
#!/bin/bash
# update the TOKEN and the CHANNELID, rest is optional
# you may need to connect with a websocket the first time you run the bot
# use a library like discord.py to do so
curl -v \
-H "Authorization: Bot TOKEN" \
-H "User-Agent: myBotThing (http://some.url, v0.1)" \
-H "Content-Type: application/json" \
@Nitecon
Nitecon / panic.go
Created February 20, 2019 21:20
Table driven golang panic test
package main
func addLevelPool(level int) {
if level > 9{
panic("runtime error: index out of range")
}
}
@jarlah
jarlah / slick.conf
Created May 9, 2020 08:04
Play Scala and Slick 3: How to connect to postgresql database that requires certificate for connecting
slick.dbs.default.profile = "slick.jdbc.PostgresProfile$"
slick.dbs.default.db.driver = "org.postgresql.Driver"
slick.dbs.default.db.url = "jdbc:postgresql://localhost:5432/<db>"
slick.dbs.default.db.user = "<user>"
slick.dbs.default.db.password = "<password>"
slick.dbs.default.db.properties.ssl = "true"
slick.dbs.default.db.properties.sslmode = "verify-ca"
slick.dbs.default.db.properties.sslfactory = "org.postgresql.ssl.jdbc4.LibPQFactory"
slick.dbs.default.db.properties.sslpassword = "<pass>" // or comment out if no password on postgresql.pk8
slick.dbs.default.db.properties.sslcert = "<path>/postgresql.crt" // the client certificate
@evanaze
evanaze / dig_asset_sharpe.py
Last active October 12, 2021 07:31
Using Amberdata to get the daily Sharpe Ratio of BTC
# our first token to try out
token = "btc"
# the url for our token
url = f"https://web3api.io/api/v2/market/metrics/{token}/historical/sharpe"
# our API key
headers = {'x-api-key': api_key["AMBERDATA_API_KEY"]}
# the start and end of the period