Skip to content

Instantly share code, notes, and snippets.

View hemanth's full-sized avatar
🐜
🧘‍♂️

Hemanth HM hemanth

🐜
🧘‍♂️
View GitHub Profile
@hemanth
hemanth / xkcd-togetherai.py
Created September 26, 2024 00:35
Explain XKCD with TogetherAI
import os
import argparse
from together import Together
def analyze_image(image_url):
client = Together(api_key=os.environ.get('TOGETHER_API_KEY'))
response = client.chat.completions.create(
model="meta-llama/Llama-Vision-Free",
messages=[
@hemanth
hemanth / summary.py
Created March 12, 2024 00:24
Summarize URL with llama_index and ollama
from llama_index.core import VectorStoreIndex, download_loader
from llama_index.llms.ollama import Ollama
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
from llama_index.core import Settings
from llama_index.llms.ollama import Ollama
from IPython.display import display
Settings.llm = Ollama(model="mistral:latest", request_timeout=30.0)
Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5")
@hemanth
hemanth / chrome-devtools-setup.bash
Last active May 29, 2021 15:22
Build chrome devtools
#!/usr/bin/bash
function colorPrint {
RED='\033[0;31m'
NC='\033[0m' # No Color
printf "${RED}$*${NC}\n"
}
function cloneDepTools {
colorPrint "Cloning depot_tools"
@hemanth
hemanth / main.html
Last active May 10, 2019 15:32
Portal W3C test
<html>
<body>
<h1>Main</h1>
<button>Load portal</button>
</body>
<script>
document.querySelector('button').addEventListener('click', () => {
const portal = document.createElement('portal');
portal.src = 'http://localhost:3001';
document.body.appendChild(portal);
@hemanth
hemanth / esnextbin.md
Last active December 15, 2016 03:42
esnextbin sketch
@hemanth
hemanth / index.js
Last active June 22, 2016 16:05
requirebin sketch
const choo = require('choo')
const app = choo()
app.model({
state: { title: 'Set the title' },
reducers: {
update: (action, state) => ({ title: action.value })
}
})
@hemanth
hemanth / index.js
Created March 6, 2015 20:10
requirebin sketch
"use strict";
var animate = require('fd-animate');
var logo = document.createElement('img')
logo.src = 'https://raw.githubusercontent.com/fp-dom/logo/master/fp-dom.png';
document.body.appendChild(logo)
@hemanth
hemanth / index.js
Last active August 29, 2015 14:16
requirebin sketch
var cnvsGrad = require('canvas-gradaint');
//canvas setup
var canvas = document.createElement('canvas');
canvas.width = '500';
canvas.height = '300';
canvas.style.outline = "1px solid black";
document.body.appendChild(canvas);
// Get the context.
@hemanth
hemanth / index.js
Created February 24, 2015 09:07
requirebin sketch
clear = require('clear-canvas');
//canvas setup
var canvas = document.createElement('canvas');
canvas.width = '500';
canvas.height = '300';
canvas.style.outline = "1px solid black";
document.body.appendChild(canvas);
// Get the context.
@hemanth
hemanth / audio-sprite.js
Last active August 29, 2015 14:15
Google IO audio sprint snippet.
function(t) {
t.exports = {
resources: ["https://events.google.com/io2015/experiment/cataudiosprite.mp3"],
spritemap: {
"arp_synth_A-sharp": {
start: 0,
end: 1.0971428571428572,
loop: !1
},
"arp_synth_A-sharp2": {