Skip to content

Instantly share code, notes, and snippets.

View reachtarunhere's full-sized avatar

Tarun Kumar Vangani reachtarunhere

View GitHub Profile

### You are a LLM model inside emacs. You are an expert at programming. Reply concisely unless otherwise asked.

Sure, I’ll do my best to provide concise responses! How can I assist you today?

### Generate Python code for a factorial function but it must contain bugs in it. Also write some tests for the same function.

Certainly! Here’s some Python code for a factorial function with intentional bugs:

def factorial(n):
@reachtarunhere
reachtarunhere / emacs_chat.md
Created March 20, 2023 17:20
emacs chat gist

------- user:Can you teach me to write a simple emacs extension?

------- assistant:

Sure, I can give you an overview of how to write a simple Emacs extension.

  1. Identify the Functionality You Want to Implement The first step is to identify the specific functionality you want to implement in your extension. For example, you might want to create a function that inserts a timestamp into the current buffer.
using CUDA, Flux, BenchmarkTools
function block_wise_kernel_sm(input, output, col_size) # 1.675 ms with 256 threads
col = blockIdx().x
stride = blockDim().x
index = (col - 1) * col_size + threadIdx().x
tid = threadIdx().x
sa = CuStaticSharedArray(Float16, 1024)
"""
A much shorter version of train.py for benchmarking
"""
import os
from contextlib import nullcontext
import numpy as np
import time
import torch
from model import GPTConfig, GPT

Project:

The aim of the project is to update algorithm implementations and add additional implementations in the fourth edition of the book. Auxiliary Interactive Visualizations were also be made with the aim of providing intuitive explanations of the algorithms. The visualizations make use of IPython along with Matpotlib, JS and networkx to make them interactive.

Links To Work:

The first link is all my work that has been merged in the main repository. https://github.com/aimacode/aima-python/commits/master?author=reachtarunhere&page=1

The links below contain additional work that has not been merged in the main repo as of now. This is because some code in the main repo requires some rewrite and this code uses the newer version. The below are link to branches on my fork. The latest commits with my name highlight the work I have done.

import requests
import inspect
from collections import OrderedDict
from requests.auth import HTTPBasicAuth
HOST = 'http://astrocytes.azurewebsites.net/'
API_ENDPOINT = 'api/v1/'
API_URL = HOST + API_ENDPOINT
JSON_HEADER = {'Content-type': 'application/json'}
@reachtarunhere
reachtarunhere / club_analysis.py
Created June 12, 2015 14:19
Clubs together different collections and inserts to new db
import pymongo
import simplejson
from bson import ObjectId
from urlparse import urlparse
client = pymongo.MongoClient()
db = client.thug
new_db = client.test_db
# check all places to put object id
@reachtarunhere
reachtarunhere / demo.py
Last active August 29, 2015 14:22
Generating Tree with Python for Rumal
import pymongo
import simplejson
from bson import ObjectId
from urlparse import urlparse
db = pymongo.MongoClient().thug
def graph_populate_node(analysis_id, new_node):
'''Adds information from different
collections to nodes.'''
@reachtarunhere
reachtarunhere / SimpleThugAPIDemo.py
Created March 26, 2015 21:34
A dead simple demo of Thug API based on thug.py file in thug
import logging
from ThugAPI import ThugAPI
log = logging.getLogger("Thug")
class Thug(ThugAPI):
def __init__(self, args):
ThugAPI.__init__(self, args)
def analyze(self):
self.log_init('http://google.com')
self.run_remote('http://google.com')
@reachtarunhere
reachtarunhere / garbage_bin.py
Created March 7, 2015 13:53
A simple python script that downloads all comic strips from Garbage Bins website. Makes use of python's urllib and beautiful soup
import urllib
from bs4 import BeautifulSoup
previous_comic_url = 'http://www.garbagebinstudios.com/comic-strips.html' #the base url
while previous_comic_url != 'http://www.garbagebinstudios.com/comic-strips/misc.html': #after the last comic the url shifts to misc
response = urllib.urlopen(previous_comic_url.encode('utf-8'))
html = response.read()
soup = BeautifulSoup(html)
comic_tag = soup.find('a', attrs={'class':'cm-image-previewer cm-previewer'})
comic_url = r'http://www.garbagebinstudios.com'+comic_tag['href']
previous_comic_tag = soup.find('div', attrs={'style':'padding-right:20px;float:right;padding-top:7px;'}).a