Skip to content

Instantly share code, notes, and snippets.

View ShabbirHasan1's full-sized avatar
:octocat:
Building Things

Shabbir Hasan ShabbirHasan1

:octocat:
Building Things
  • India
View GitHub Profile
@ShabbirHasan1
ShabbirHasan1 / Encoding_and_decoding.rs
Created December 7, 2024 08:23 — forked from bareeves/Encoding_and_decoding.rs
Binary encoding and decoding
use std::convert::TryInto;
use std::fmt;
/// A simple hash wrapper for a fixed-size array.
#[derive(Clone)]
pub struct Hash([u8; 32]);
impl Hash {
/// Creates a new `Hash` from a byte array.
pub fn new(bytes: [u8; 32]) -> Self {

UI and Declarative Programming in Rust

The graphical user interface (GUI) is the cornerstone of most modern applications. It is often the main interface to use a computer program, providing a bridge from your software to someone out there in the world. Therefore, to best represent our hard-earned application logic, a GUI should be responsive, robust, and accessible.

So let's use Rust, a modern language for efficient and robust software! Well...

Why are user interfaces so hard for Rust?

I've been working on open-source Rust projects for about 8 years now,

{
"info": {
"_postman_id": "628c6320-6b30-4c04-9945-7de283730c26",
"name": "Upstox Developer API",
"description": "Build your App on the Upstox platform\n\n<img src=\"/developer/api-documentation/images/brokerage_free_banner.png\" alt=\"Banner\">\n\n<a href=\"https://marketing-creative-and-docs.s3.ap-south-1.amazonaws.com/API_T%26C/T%26C+apply.pdf\">\\* Terms and Conditions</a>\n\n<h2>Introduction</h2>\n\nUpstox API is a set of rest APIs that provide data required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (using Websocket), and more, with the easy to understand API collection.\n\nAll requests are over HTTPS and the requests are sent with the content-type ‘application/json’. Developers have the option of choosing the response type as JSON or CSV for a few API calls.\n\nTo be able to use these APIs you need to create an App in the Developer Console and generate your **apiKey** and **apiSecret**. You can use a redirect
@ShabbirHasan1
ShabbirHasan1 / async_kiteext_ticker.py
Created September 14, 2024 09:23 — forked from MooneDrJune/async_kiteext_ticker.py
KiteConnect Extras Async KiteConnect Ticker
from __future__ import annotations
from asyncio.exceptions import CancelledError
from typing import (
Any,
Callable,
Dict,
List,
Literal,
Optional,
NoReturn,
@ShabbirHasan1
ShabbirHasan1 / kiteconnect_extras.py
Created September 14, 2024 09:22 — forked from MooneDrJune/kiteconnect_extras.py
KiteConnect Extras Async KiteConnect
from __future__ import annotations
# -*- coding: utf-8 -*-
"""
:description: KiteConnect (Batteries Included) On Steroids Version.
:license: MIT.
:author: Dr June Moone
:created: On Saturday July 29, 2023 19:56:53 GMT+05:30
"""
__author__ = "Dr June Moone"
__webpage__ = "https://github.com/MooneDrJune"
@ShabbirHasan1
ShabbirHasan1 / sell_straddle_at_best_ask_function.py
Created September 14, 2024 09:17
sell_straddle_at_best_ask_function
def punch_short_straddle_at_best_ask(
symbol: str, enctoken: str, exch: str = "NFO", lots: int = 1
):
(pd, rqs, api_url, idx_sym) = (
__import__("pandas"),
__import__("requests").session(),
"https://api.kite.trade",
{
"NIFTY": "NIFTY 50",
"BANKNIFTY": "NIFTY BANK",
@ShabbirHasan1
ShabbirHasan1 / KiteApiLogin.py
Created September 14, 2024 09:16
KiteConnect API Login Without Selenium
import logging, pyotp, kiteconnect.exceptions as ex
from kiteconnect import KiteConnect
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
class Kite(KiteConnect):
KITE_API_DEV_LOGIN = "https://kite.trade/connect/login"
@ShabbirHasan1
ShabbirHasan1 / ExtractMetaFromTradingSymbol.py
Created September 14, 2024 09:12
Extract Metadata From Trading Symbol.
from __future__ import annotations
import re, pandas as pd
from typing import Dict
from functools import lru_cache
from datetime import date, datetime as dt
DERIVATIVES_TRADINGSYMBOL_META = re.compile(
"(?P<instrument>[A-Z]+)(?P<expiry>[A-Z0-9]{5})(?P<instrument_type>[A-Z0-9.]+)"
)
OND_MAP = {"O": "Oct", "N": "Nov", "D": "Dec"}
@ShabbirHasan1
ShabbirHasan1 / OpenBSD_on_Apple_M2_QEMU.md
Created September 9, 2024 16:08 — forked from astreknet/OpenBSD_on_Apple_M2_QEMU.md
OpenBSD on Apple M2 with QEMU

OpenBSD on Apple M2 with QEMU

Minimalist installation of OpenBSD on the Apple M2 using QEMU

Ingredients

Installation

  1. install QEMU with Homebrew brew install qemu, also possible with MacPorts
  2. Write a script with execute permissions chmod +x qemu_aarch64_install_openbsd.sh for installing the image.
@ShabbirHasan1
ShabbirHasan1 / clickhouse_install.sh
Created September 6, 2024 16:50 — forked from githubdebugger/clickhouse_install.sh
clickhouse_install.sh
#!/bin/bash
# Function to prompt user for yes/no input
ask_yes_no() {
while true; do
read -p "$1 (y/n): " yn
case $yn in
[Yy]* ) return 0;;
[Nn]* ) return 1;;
* ) echo "Please answer yes or no.";;