Skip to content

Instantly share code, notes, and snippets.

# install_certifi.py
#
# sample script to install or update a set of default Root Certificates
# for the ssl module. Uses the certificates provided by the certifi package:
# https://pypi.python.org/pypi/certifi
import os
import os.path
import ssl
import stat
@Tapanhaz
Tapanhaz / send_file_from_memory.py
Created April 29, 2023 18:37 — forked from ohld/send_file_from_memory.py
How to send a CSV file with Telegram bot from memory (buffer, StringIO, BytesIO)
import csv, io
test_data = [[1, 2, 3], ["please", "follow", "me"]]
# csv module can write data in io.StringIO buffer only
s = io.StringIO()
csv.writer(s).writerows(test_data)
s.seek(0)
# python-telegram-bot library can send files only from io.BytesIO buffer
@Tapanhaz
Tapanhaz / kiteconnect_extras.md
Created August 31, 2023 06:16
KiteConnectExt On Steroids

Features of kiteconnect_extras / KiteConnect Extras On Steriod Version

- IPC Enabled `KiteConnect` aka `KiteExt`
- IPC Enabled `KiteTicker` aka `KiteExtTicker`

Additional Features of the new KiteExt on Steriods.

1.  Offers Feature to be used in other brokers `Python SDk` for obtaining `historical_data` 
    from existing running master kite `KiteExt` instance on a different process. 1000's of 

seperate processes belonging to different/same sdk can get the historical data without any issue.

@Tapanhaz
Tapanhaz / Simple_calculator.py
Last active October 23, 2023 09:41
Simple calculator for dealing with large numbers
def display_menu():
check_1 = check_2 = check_3 = False
while True:
if not check_1:
try:
x = float(input("Enter Number 1 :: "))
check_1 = True
except ValueError:
print("Please Enter Number Only.")
@Tapanhaz
Tapanhaz / num_to_letter_sorted.py
Last active October 25, 2023 17:42
Sorted list of Number to Letter
'''
The number to letter function is taken from stackoverflow .. I just make small edits
to match the output
'''
def number_to_letter(number):
if number >= 1 and number <= 99:
a = [
'', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve',
'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty', 'thirty',
'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'
@Tapanhaz
Tapanhaz / autoview-syntax.txt
Created October 29, 2023 15:00 — forked from tranzium/autoview-syntax.txt
TradingView can now become automated trading.
---------- Usage
The syntax created by these parameters is placed in an alert's description on TradingView
to be utilized by Autoview, a Chrome Extension.
Autoview: https://chrome.google.com/webstore/detail/autoview/okdhadoplaoehmeldlpakhpekjcpljmb
> Website: https://autoview.with.pink
> Help: https://use.autoview.with.pink
> Discord: https://discordapp.com/invite/BFz8VPn
TradingView: https://tradingview.go2cloud.org/aff_c?offer_id=2&aff_id=1187
@Tapanhaz
Tapanhaz / download_file.rs
Created November 7, 2023 14:46 — forked from giuliano-macedo/download_file.rs
Download large files in rust with progress bar using reqwest, future_util and indicatif
// you need this in your cargo.toml
// reqwest = { version = "0.11.3", features = ["stream"] }
// futures-util = "0.3.14"
// indicatif = "0.15.0"
use std::cmp::min;
use std::fs::File;
use std::io::Write;
use reqwest::Client;
use indicatif::{ProgressBar, ProgressStyle};
@Tapanhaz
Tapanhaz / interesting.md
Created November 7, 2023 14:50 — forked from giuliano-macedo/interesting.md
Interesting python stuff

Interesting python stuff i found messing around with it

1 hash function is random for non non-primitive objects, and it's seed is reset each time the interpreter is ran

Example: python -c "print(hash('hello world'))" generates random numbers, while python -c "print(hash(4.2))" always returns a constant value

2 list.extend method updates itself each time the iterator is called

This code will run forever ( and eat all your RAM ):

@Tapanhaz
Tapanhaz / days_near_to_month_ends.py
Last active November 15, 2023 05:12
Extract nearest dates to the month ends
from itertools import groupby
def get_middle_part(date_string):
return date_string.split('-')[1]
def get_last_part(date_string):
return date_string.split('-')[2]
def dates_nearest_to_month_last(date_list):
@Tapanhaz
Tapanhaz / mngw-w64_boost.MD
Created December 25, 2023 14:53 — forked from zrsmithson/mngw-w64_boost.MD
Installing boost on Windows using MinGW-w64 (gcc 64-bit)

Installing boost on Windows using MinGW-w64 (gcc 64-bit)

Introduction

Boost is easy when you are using headers or pre-compiled binaries for visual studio, but it can be a pain to compile from source on windows, especially when you want the 64-bit version of MinGW to use gcc/g++. This installation process should be thorough enough to simply copy and paste commands, but robust enough to install everything you need.

Note: if you need to install any of the libraries that need dependencies, see this great answer from stack overflow

Get files needed for install

Get the MinGW installer mingw-w64-install.exe from Sourceforge
Get the boost_1_68_0.zip source from Sourceforge
__Note: This should work perfectly w