Skip to content

Instantly share code, notes, and snippets.

View rep-movsd's full-sized avatar

Vivek rep-movsd

View GitHub Profile
#!/usr/bin/python3
'''
This script parses the HTML file from https://www.moneycontrol.com/stocks/marketinfo/dividends_declared/index.php and
creates a CSV file with relevant data
Sheet will contain all upcoming dividends after the current date, and those whose percentage is declared
It calculates the net percentage earning per rupee invested if you buy the stock at current price and hold it till the record date
To run this script, you need to first create:
@rep-movsd
rep-movsd / bench.cpp
Last active December 4, 2022 13:48
Benchmark code for the indexed iterator (see comments for results)
#include <algorithm>
#include <numeric>
#include <vector>
#include "benchmark/benchmark.h"
#include "buf_idx_iter.hpp"
template <typename T>
void BM_std_sort(benchmark::State& state)
{
@rep-movsd
rep-movsd / buf_idx_iter.hpp
Created December 4, 2022 13:39
A C++ iterator class that uses integer indices rather than pointers
template<typename T>
class buf_idx_iter
{
public:
using iterator_category = std::random_access_iterator_tag;
using value_type = T;
using difference_type = std::ptrdiff_t;
using pointer = T*;
using reference = T&;
@rep-movsd
rep-movsd / gpt_iter.cpp
Last active December 4, 2022 11:49
Trying to get GPT to write an iterator class conformant with the C++ std lib
//========================================================================================================================================
// Write an template iterator class with just the tags in it
//========================================================================================================================================
template<typename T>
class iterator
{
public:
using iterator_category = std::random_access_iterator_tag;
using value_type = T;
I am attesting that this GitHub handle rep-movsd is linked to the Tezos account tz1WdmziqzcmqdRPPg5N1NBME8NrqZAVDaGq for tzprofiles
sig:edsigtmoEDmGt45vS6Ja1KC3m9XNS4kZhaaVCkHnNkQYPnc8CcVdkgaEm65bmQgYDfdUt8Pjj7bLH8PXaBFBDLxfTkPDotKrtgu
I am attesting that this GitHub handle rep-movsd is linked to the Tezos account tz1W4jq35csgLVWHSk9fVw1DL24SnZ8ZP1ny for tzprofiles
sig:edsigtaaJH4DkB3dF1ucgApS9Qv3J1jXzPQZCP1QwkhBxoGfTHdUaFLXna7e1bpSjBGrav1Xukov2odTEQiX3i6XGQrrUmPFLJZ
#!/usr/bin/python
# Abcdexter, 7/7/2021, 1142
############################
# imports
############################
import sys
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
@rep-movsd
rep-movsd / puzzle.py
Last active May 16, 2021 10:00
Word puzzle checker
#/usr/bin/python
import sys
import json
# open grid file
with open(sys.argv[1]) as f:
lines = [line.rstrip('\n') for line in f]
# make the grid but padded on left right and bottom sides with a sentinel like this (makes it easy to grab diagonals)
@rep-movsd
rep-movsd / index.html
Created April 3, 2020 11:31
React at CodePen
<div id="app"></app>
@rep-movsd
rep-movsd / demo_donut.js
Created July 23, 2019 15:02
Dweet 1: Rain-bough-nut
function u(t)
{
z=255
for(i=0;i<z/2;++i)
{
r=z*1.5-i
b=t+i*9/z
sa=S(t)*z
x.fillStyle=R(z-sa,z-C(t)*z,sa,0.01)
x.fillRect(780+r*S(b),420+r*C(b),80,90)