Skip to content

Instantly share code, notes, and snippets.

View vrthra's full-sized avatar

Rahul Gopinath vrthra

View GitHub Profile
@vrthra
vrthra / LLM.md
Created April 18, 2023 11:29 — forked from rain-1/LLM.md
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

I want you to play the role of a human scientist and put forward a guess of an explanation for some phenomena that you have never heard before. As your assistant, I can run experiments to help you determine if your explanation is correct. Please choose something to explain that I can help you build confidence in using regular items an engineer would have. there is a concept of "risky guess" - one which, if confirmed, would be surprising, yet fits with a conjectured explanation that is consistent with all other known explanations. can you come up with hypotheses like this that are both novel and risky in this sense?
Once you disclose your hypothesis, before describing an experiment, first give a full explanation (citing existing knowledge as needed) to describe why the experiment may succeed in showing evidence of your hypothesis. Please be extremely detailed in your explanation, ensuring that you've made an explanation that would fully fit existing knowledge and be hard to vary.
@vrthra
vrthra / gist:2036ea460780423be6eeb3e2413ca2ff
Created September 30, 2022 08:22
Resizing Ubuntu Vagrant VM
unless Vagrant.has_plugin?("vagrant-disksize")
raise Vagrant::Errors::VagrantError.new, "vagrant-disksize plugin is missing. Please install it using 'vagrant plugin install vagrant-disksize' and rerun 'vagrant up'"
end
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-20.04"
config.disksize.size = '400GB'
config.vm.provision "shell", inline: <<-SHELL
ROOT_DISK_DEVICE="/dev/sda"
ROOT_DISK_DEVICE_PART="/dev/sda3"
@vrthra
vrthra / Working GDB on macOS 11.md
Created August 19, 2022 22:44 — forked from mike-myers-tob/Working GDB on macOS 11.md
Steps to get GDB actually working in April 2021 on macOS

Debug with GDB on macOS 11

The big reason to do this is that LLDB has no ability to "follow-fork-mode child", in other words, a multi-process target that doesn't have a single-process mode (or, a bug that only manifests when in multi-process mode) is going to be difficult or impossible to debug, especially if you have to run the target over and over in order to make the bug manifest. If you have a repeatable bug, no big deal, break on the fork from the parent process and attach to the child in a second lldb instance. Otherwise, read on.

Install GDB

Don't make the mistake of thinking you can just brew install gdb. Currently this is version 10.2 and it's mostly broken, with at least two annoying bugs as of April 29th 2021, but the big one is https://sourceware.org/bugzilla/show_bug.cgi?id=24069

$ xcode-select install  # install the XCode command-line tools
@vrthra
vrthra / leo.py
Last active August 17, 2022 08:36
Earley Parser
#!/usr/bin/env python3
import re, string
START_SYMBOL = '<start>'
RE_NONTERMINAL = re.compile('(<[^<> ]*>)')
EPSILON = ''
def fixpoint(f):
def helper(arg):
while True:
sarg = str(arg)
~/snap/barrier/<3digit#>/.local/share/barrier/SSL and created the Fingerprints folder
openssl req -x509 -nodes -days 365 -subj /CN=barrier -newkey rsa:4096 -keyout Barrier.pem -out Barrier.pem
openssl x509 -fingerprint -sha1 -noout -in Barrier.pem > Fingerprints/Local.txt
sed -e "s/.*=//" -i Fingerprints/Local.txt
https://superuser.com/questions/656912/synergy-on-mavericks-osx-10-9-and-enable-assistive-devices
Make sure to enable ssh
import sys
def add(L, u, j, R):
R.append((L, u, j))
def pop(s, i, R):
s, (L, i_) = s # pop(s, i, R)
add(L, s, i, R) # check and add
return s, R
def push(s, t):
@vrthra
vrthra / gantt.py
Created May 16, 2022 01:18 — forked from Thiagobc23/gantt.py
Gantt Chart with Matplotlib v2
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from pandas import Timestamp
##### DATA #####
data = {'Task': {0: 'TSK M',
1: 'TSK N',
2: 'TSK L',
@vrthra
vrthra / recursive_call.py
Last active April 17, 2022 20:32
Getting around Python recursion limit
# https://speakerdeck.com/dabeaz/generators-the-final-frontier?slide=163
def cps(gen):
stack = [gen]
ret = None
while stack:
try:
value, ret = ret, None
res = stack[-1].send(value)
stack.append(res)
except StopIteration as e:
def to_stack(ds):
expanded = []
to_expand = [ds]
while to_expand:
ds, *to_expand = to_expand
if type(ds) in {list, set, tuple}:
expanded.append(type(ds))
expanded.append(len(ds))
to_expand = list(ds) + to_expand
elif type(ds) in {dict}: