Skip to content

Instantly share code, notes, and snippets.

View shortthirdman's full-sized avatar
🎯
Focusing

Swetank Mohanty shortthirdman

🎯
Focusing
View GitHub Profile
@shortthirdman
shortthirdman / SVB_Inverted_Curve_and_Bond_Risk.ipynb
Last active April 24, 2025 12:14
SVB, Inverted Curve, and Bond Risk
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shortthirdman
shortthirdman / Stock_Market_Forecasting.ipynb
Created April 24, 2025 12:11
Stock Market Forecasting with Differential Graph Transformer
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import java.util.*;
import java.util.stream.Collectors;
/**
* TransactionType enum as an example.
* In your challenge environment, this might be pre-defined.
*/
enum TransactionType {
P2P,
P2M,
@shortthirdman
shortthirdman / async_retry.py
Created March 25, 2025 11:43
Async Retry Decorator
import functools
import time
import random
import asyncio
def async_retry(max_retries=3, start_delay=2, backoff_factor=2, exceptions=(Exception,)):
"""Retry decorator for async functions with exponential backoff."""
def decorator(func):
@functools.wraps(func)
async def wrapper(*args, **kwargs):
import asyncio
import aiohttp
import random
from bs4 import BeautifulSoup
class AsyncScraper:
def __init__(self, max_concurrency=20):
self.semaphore = asyncio.Semaphore(max_concurrency)
self.user_agents = [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
@shortthirdman
shortthirdman / .gitconfig
Created March 20, 2025 16:51
Git Configuration on Windows/Mac/Linux
# clearly makes git better
[column]
ui = auto
[branch]
sort = -committerdate
[tag]
sort = version:refname
[init]
defaultBranch = main
[diff]
@shortthirdman
shortthirdman / LRUCache.java
Created March 20, 2025 15:24
LRU (Least Recently Used) Cache
public class LRUCache {
private int capacity;
private Map<Integer, Integer> cache;
private LinkedHashMap<Integer, Long> accessTime;
public LRUCache(int capacity) {
this.capacity = capacity;
this.cache = new HashMap<>();
this.accessTime = new LinkedHashMap<>();
}
@shortthirdman
shortthirdman / permute_unique.py
Created March 20, 2025 15:22
Permute Unique Numbers
def permuteUnique(nums):
def backtrack(path, used):
if len(path) == len(nums):
result.append(path[:])
return
for i in range(len(nums)):
if used[i]:
continue
# Skip duplicates
if i > 0 and nums[i] == nums[i - 1] and not used[i - 1]:
@shortthirdman
shortthirdman / jvm.config
Last active March 7, 2025 16:53
JVM Configuration
-Xms1g -Xmx2g -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+PrintMemoryMapAtExit
@shortthirdman
shortthirdman / application.yaml
Last active March 3, 2025 16:53
Spring Boot (2.x or 3.x or above) Configuration
server:
shutdown: graceful
compression:
enabled: true
port: 8080
address: localhost
error:
include-binding-errors: ALWAYS
include-exception: true
include-message: ALWAYS