Skip to content

Instantly share code, notes, and snippets.

View gurusura's full-sized avatar

Gurumurthi V Ramanan gurusura

View GitHub Profile
#-*- coding:utf-8 - *-
def load_dataset():
"Load the sample dataset."
return [[1, 3, 4], [2, 3, 5], [1, 2, 3, 5], [2, 5]]
def createC1(dataset):
"Create a list of candidate item sets of size one."
@gurusura
gurusura / simulator.py
Created December 21, 2020 13:08 — forked from markusrenepae/simulator.py
This gist is for another medium article and is about an investment simulator.
import pandas as pd
import numpy as np
import datetime as dt
import math
import warnings
warnings.filterwarnings("ignore")
prices = pd.read_csv("adjclose.csv", index_col="Date", parse_dates=True)
volumechanges = pd.read_csv("volume.csv", index_col="Date", parse_dates=True).pct_change()*100
@gurusura
gurusura / textbook.py
Created January 18, 2021 18:32 — forked from Evantm/textbook.py
Command line python script that scrapes TRU Bookstore then searches Libgen for that book.
import sys
from requests import get
from bs4 import BeautifulSoup
# Put in your class details. It scans TRU bookstore to get ISBN
# It uses the ISBN to search Libgen to get MD5
# It then downloads from Libgen using the MD5
def make_request(url):
headers = {
'Host': 'thebookstore.tru.ca',
'Connection': 'keep-alive',
"""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Simple Hyperbolic tiling animation using taichi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import taichi as ti
ti.init(arch=ti.cpu)
# ----------------------------------------------
# global settings
@gurusura
gurusura / pdfcompress.py
Created April 3, 2022 05:51 — forked from ilovefreesw/pdfcompress.py
A Python script to batch compress PDF files on Windows, MAC, and Linux. Make sure gs and Python are in PATH before running this script.
from __future__ import print_function
import os
import subprocess
root = "."
try:
os.mkdir('compressed')
except FileExistsError:
pass
# import the necessary packages
from scipy.spatial import distance as dist
import numpy as np
import imutils
from imutils import contours
from imutils import perspective
import cv2
# detect aruco marker
def findArucoMarkers(img, markerSize = 6, totalMarkers=100, draw=True):
@gurusura
gurusura / painless_q.py
Created October 26, 2022 06:06 — forked from kastnerkyle/painless_q.py
Painless Q-Learning Tutorial implementation in Python http://mnemstudio.org/path-finding-q-learning-tutorial.htm
# Author: Kyle Kastner
# License: BSD 3-Clause
# Implementing http://mnemstudio.org/path-finding-q-learning-tutorial.htm
# Q-learning formula from http://sarvagyavaish.github.io/FlappyBirdRL/
# Visualization based on code from Gael Varoquaux [email protected]
# http://scikit-learn.org/stable/auto_examples/applications/plot_stock_market.html
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
@gurusura
gurusura / app.py
Created January 24, 2023 12:40 — forked from jflam/app.py
Citations needed
# To run you'll need some secrets:
# 1. SERPAPI_API_KEY secret in env var - get from https://serpapi.com/
# 2. OPENAI_API_KEY secret in env var - get from https://openai.com
import streamlit as st
import json, os
from langchain.prompts import PromptTemplate
from langchain.llms import OpenAI
from serpapi import GoogleSearch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gurusura
gurusura / transformer.py
Created July 10, 2024 16:04 — forked from nreHieW/transformer.py
2024 Noam Transformer
"""
The 2024 Transformer (the Noam Transformer):
- RMSNorm
- GQA or some combination
- Sliding window attention
- Swiglu
- RoPE (Rotary Positional Embedding)
LLM Arches:
hidden | MLP mult. | n_layers | rope_theta | GQA Group Size | GLU Act. | ops