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
//Exp 1 all parts | |
//Author: KS [not to be shared till Mon evening!] | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <math.h> | |
int NODE_COUNT=12; | |
int MAX_COST=99; | |
float Dg = 1.8; |
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
#!/usr/bin/env python | |
import subprocess | |
import sys | |
# pip install flickrapi | |
# project home: http://stuvel.eu/flickrapi | |
import flickrapi | |
api_key = '00000000000000000000000000000000' # obtain your api key at http://www.flickr.com/services |
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
#include <iostream> | |
#include <chrono> | |
#include <random> | |
#define DOUBLE_PRECISION 10000 | |
#define LAMBDA 5 | |
using namespace std; | |
struct packet { |
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
import logging | |
# Create a custom logger class | |
class FileLogger(logging.Logger): | |
def __init__(self, name, filename, mode='a', level=logging.INFO, fformatter=None, log_to_console=False, sformatter=None): | |
super().__init__(name, level) | |
# Create a custom file handler | |
self.file_handler = logging.FileHandler(filename=filename, mode=mode) |
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
import os | |
import time | |
import io | |
import requests | |
nse_urls = { | |
'N50':'', | |
'N100':'', | |
'N200':'', |
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
from enum import Enum | |
#Inspired by: https://bobbyhadz.com/blog/python-compare-string-with-enum | |
# and https://stackoverflow.com/questions/76236985/how-to-compare-string-enums-in-python | |
class OrderedStrEnum(str, Enum): | |
def __ge__(self, other): | |
if self.__class__ is other.__class__: | |
return self._index() >= other._index() |
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
// Function to adjust the volume of a video element | |
function adjustVideoVolume(videoElement, volume) { | |
// Create an audio context | |
const audioCtx = new (window.AudioContext || window.webkitAudioContext)(); | |
// Create a media element source from the video element | |
const source = audioCtx.createMediaElementSource(videoElement); | |
// Create a gain node to control the volume | |
const gainNode = audioCtx.createGain(); |
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
import threading | |
import os | |
import signal | |
import time | |
""" | |
This script demonstrates the adjustment of thread priorities and handling Ctrl+C to gracefully stop threads. | |
Thread Priority Mechanism: |
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
def interpolate_timestamps(df, col): | |
# Convert the timestamp column to numeric values (in us since Unix epoch) | |
numeric_ts = pd.to_numeric(df[col]) | |
# Replace any numeric values that are less than 0 with NaN | |
# This step is crucial because pd.to_numeric() can convert NaT (Not-a-Time) values | |
# to large negative numbers. By replacing these with NaN, we ensure they are | |
# correctly identified as missing values for interpolation. | |
numeric_ts[numeric_ts < 0] = np.nan |
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
https://www.nseindia.com/corporates/datafiles/AN_NAV_LATEST_ANNOUNCED.csv | |
https://www.nseindia.com/corporates/datafiles/BM_All_Forthcoming.csv | |
https://www.nseindia.com/corporates/datafiles/CA_TODAY_SPLIT.csv | |
https://www.nseindia.com/corporates/datafiles/CA_TODAY_BONUS.csv | |
http://www.nseindia.com/corporates/datafiles/CA_LAST_1_MONTH_BONUS.csv | |
https://www.nseindia.com/corporates/datafiles/CA_LAST_1_WEEK_SPLIT.csv | |
https://www.nseindia.com/corporates/datafiles/CA_LAST_1_WEEK_BONUS.csv | |
https://www.nseindia.com/corporates/datafiles/CA_MORE_THAN_24_MONTHS_SPLIT.csv | |
https://www.nseindia.com/corporates/datafiles/CA_MORE_THAN_24_MONTHS_BONUS.csv | |
http://www.nseindia.com/corporates/datafiles/CA_LAST_1_MONTH_RIGHTS.csv |
OlderNewer