Skip to content

Instantly share code, notes, and snippets.

View ronalddas's full-sized avatar
🎯
Focusing

Ronald Das ronalddas

🎯
Focusing
View GitHub Profile
@dangovorenefekt
dangovorenefekt / blockmetatwitter.md
Last active May 7, 2024 11:06
Block Meta and Twitter (nginx)
@rain-1
rain-1 / llama-home.md
Last active May 7, 2024 13:50
How to run Llama 13B with a 6GB graphics card

This worked on 14/May/23. The instructions will probably require updating in the future.

llama is a text prediction model similar to GPT-2, and the version of GPT-3 that has not been fine tuned yet. It is also possible to run fine tuned versions (like alpaca or vicuna with this. I think. Those versions are more focused on answering questions)

Note: I have been told that this does not support multiple GPUs. It can only use a single GPU.

It is possible to run LLama 13B with a 6GB graphics card now! (e.g. a RTX 2060). Thanks to the amazing work involved in llama.cpp. The latest change is CUDA/cuBLAS which allows you pick an arbitrary number of the transformer layers to be run on the GPU. This is perfect for low VRAM.

  • Clone llama.cpp from git, I am on commit 08737ef720f0510c7ec2aa84d7f70c691073c35d.
@avelican
avelican / yt-txt.py
Created April 30, 2023 08:19
Get YouTube transcript (from subtitles / caption file)
import sys
import subprocess
if len(sys.argv) < 2:
print("Please provide a YouTube video URL as the first argument.")
sys.exit(1)
video_url = sys.argv[1]
command = [
@avelican
avelican / keypoints.py
Created April 26, 2023 23:04
Keypoints.py - Summarize a long text document to bullet points
import os
import openai
prompt = "I'm a busy CEO, please summarize the following in 10-20 bullet points. Include only the most important, useful or interesting information.\n\n"
# model = 'gpt-3.5-turbo' # 'gpt-4' # moved to gpt_chat_completion since we use both
CONTEXT_SIZE = 4096 # 2048 for GPT-3 (as half the input.
# CONTEXT_SIZE = 1024 # tiny context for testing
MAX_TOKENS_IN = int(CONTEXT_SIZE*2/3)
MAX_TOKENS_OUT = CONTEXT_SIZE - MAX_TOKENS_IN
@alexpearce
alexpearce / app.py
Created June 17, 2022 03:08
FastAPI application demonstrating proper Bearer token usage.
import typing as t
from fastapi import Depends, FastAPI, Header, HTTPException
from fastapi.security.http import HTTPAuthorizationCredentials, HTTPBearer
from pydantic import BaseModel
from starlette import status
app = FastAPI()
# Placeholder for a database containing valid token values
@sandys
sandys / hardware_token.md
Last active May 19, 2020 14:14
Registering a hardware token

OSX - https://github.com/OpenSC/OpenSC/releases/download/0.16.0/OpenSC-0.16.0.dmg

Fedora - sudo dnf install pcsc-tools opensc ccid

ubuntu - sudo dnf install pcsc-tools opensc libccid

Find out where OpenSC has installed the pkcs11 module.

For OS X with binary installation this is typically in /Library/OpenSC/lib/. Homebrew users can use export OPENSC_LIBS=$(brew --prefix opensc)/lib

@lebedov
lebedov / ct_win.py
Created April 6, 2017 16:49
Routines for scaling biomedical image data by window level and width.
#!/usr/bin/env python
"""
Routines for scaling biomedical image data by window level and width.
"""
import numpy as np
win_dict = {'abdomen':
{'wl': 60, 'ww': 400},
@GMMan
GMMan / ubuntu-gl502vs.md
Last active July 22, 2020 15:30
Problems and Solutions for Ubuntu 16.04 LTS on ASUS ROG GL502VS Laptop

Problems and Solutions for Ubuntu 16.04 LTS on ASUS ROG GL502VS Laptop

NVIDIA Graphics

Nouveau does not appear to support Pascal cards right now, so you should use the proprietary NVIDIA driver, available from the Additional Drivers applet.

Panel Dithering

@adamstac
adamstac / gist:7462202
Last active January 5, 2024 00:01
Install and configure Sendmail on Ubuntu

Install and configure Sendmail on Ubuntu

This should help you get Sendmail installed with basic configuration on Ubuntu.

  1. If sendmail isn't installed, install it: sudo apt-get install sendmail
  2. Configure /etc/hosts file: nano /etc/hosts
  3. Make sure the line looks like this: 127.0.0.1 localhost yourhostname
  4. Run Sendmail's config and answer 'Y' to everything: sudo sendmailconfig
  5. Restart apache sudo service apache2 restart
@sloria
sloria / bobp-python.md
Last active May 1, 2024 08:37
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens