Skip to content

Instantly share code, notes, and snippets.

View shreyaskarnik's full-sized avatar
🤖

Shreyas Karnik shreyaskarnik

🤖
View GitHub Profile
@shreyaskarnik
shreyaskarnik / example_llama_cpp_langchain_tools.py
Created January 20, 2024 02:19
This gist demonstrates how to use langchain tools with functionary with llama_cpp for local inference on macos
# This example script showcases how to use llama_cpp to run inference
# and use langchain tools
# please install langchain first: pip install langchain
# this example uses https://github.com/MeetKai/functionary/pull/93 as the basis to demonstrate use of langchain tools.
import asyncio
import json
from typing import List
from huggingface_hub import hf_hub_download
@shreyaskarnik
shreyaskarnik / models.py
Created January 5, 2024 18:32
updated code to load model from mlx-community for finetuning see issue https://github.com/ml-explore/mlx-examples/issues/232
# Copyright © 2023 Apple Inc.
import math
from dataclasses import dataclass
from typing import List, Optional, Tuple
import mlx.core as mx
import mlx.nn as nn
from mlx.utils import tree_map, tree_unflatten
package main
import (
"bufio"
"errors"
"fmt"
"io"
"net"
"os"
"os/signal"

Keybase proof

I hereby claim:

  • I am shreyaskarnik on github.
  • I am shreyask (https://keybase.io/shreyask) on keybase.
  • I have a public key ASCvEj96FbVC0-4GgTHpiTMXxd2QfMfEiAZf-qSj8kkM5wo To claim this, I am signing this object:
{
  "body": {
    "key": {
@shreyaskarnik
shreyaskarnik / custom.css
Created February 19, 2018 03:46
Custom Logo in Jupyter Notebook
#ipython_notebook {
height: 40px !important;
}
#ipython_notebook img{
display:block;
background: url(logo.png) no-repeat;
background-size: contain;
width: 233px;
height: 33px;
padding-left: 233px;
@shreyaskarnik
shreyaskarnik / keybase.md
Created November 21, 2017 04:35
Keybase Github Verification

Keybase proof

I hereby claim:

  • I am shreyu86 on github.
  • I am shreyask (https://keybase.io/shreyask) on keybase.
  • I have a public key whose fingerprint is 3348 CCD4 3ADF DDD8 948D F9BE 46BD E9D8 91DB 4C6E

To claim this, I am signing this object:

@shreyaskarnik
shreyaskarnik / ha.yaml
Last active February 28, 2017 01:01
ha
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 180
# metric for Metric, imperial for Imperial
unit_system: metric
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: America/Chicago
@shreyaskarnik
shreyaskarnik / json-view.css
Last active January 5, 2017 18:19
JSONView Theme
body {
white-space: pre;
font-family: 'Ubuntu Mono';
font-size: 16px;
line-height:20px;
color: white;
background-color: #2B2A27;
}
.property {
@shreyaskarnik
shreyaskarnik / Instructions.md
Last active March 24, 2023 15:35
Route Docker Logs to ELK Stack
  • With Docker 1.8.0 shipped new log-driver for GELF via UDP, this means that the logs from Docker Container(s) can be shipped directly to the ELK stack for further analysis.
  • This tutorial will illustrate how to use the GELF log-driver with Docker engine.
  • Step 1: Setup ELK Stack:
    • docker run -d --name es elasticsearch
    • docker run -d --name logstash --link es:elasticsearch logstash -v /tmp/logstash.conf:/config-dir/logstash.conf logstash logstash -f /config-dir/logstash.conf
    • Note the config for Logstash can be found at this link
    • docker run --link es:elasticsearch -d kibana
  • Once the ELK stack is up now let's fire up our nginx container which ships its logs to ELK stack.
  • LOGSTASH_ADDRESS=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' logstash)
  • `docker run -d --net=host --log-driver=gelf --log-opt gelf-address=u
@shreyaskarnik
shreyaskarnik / logstash.conf
Last active November 3, 2016 01:29
Logstash-gelf-conf
input {
gelf {}
}
output {
elasticsearch {
host => "elasticsearch"
protocol => "http"
workers=> 10
}
stdout {