Skip to content

Instantly share code, notes, and snippets.

View rankun203's full-sized avatar
🔨
building things

Kun R rankun203

🔨
building things
View GitHub Profile
@jvelezmagic
jvelezmagic / main.py
Created May 17, 2023 12:05
Langchain FastAPI stream with simple memory
# The goal of this file is to provide a FastAPI application for handling
# chat requests amd generation AI-powered responses using conversation chains.
# The application uses the LangChaing library, which includes a chatOpenAI model
# for natural language processing.
# The `StreamingConversationChain` class is responsible for creating and storing
# conversation memories and generating responses. It utilizes the `ChatOpenAI` model
# and a callback handler to stream responses as they're generated.
# The application defines a `ChatRequest` model for handling chat requests,
@Zendelo
Zendelo / calc_ndcg.py
Last active August 22, 2024 14:04
Script to calculate nDCG scores between a TREC format run file and a Qrels file
import argparse
import pandas as pd
import numpy as np
TREC_RES_COLUMNS = ['qid', 'iteration', 'docNo', 'rank', 'docScore', 'method']
TREC_QREL_COLUMNS = ['qid', 'iteration', 'docNo', 'rel']
parser = argparse.ArgumentParser(description='Calculates NDCG@k')
parser.add_argument('qrels_file', type=str, help='path to a qrels file')
@prologic
prologic / LearnGoIn5mins.md
Last active November 5, 2024 02:14
Learn Go in ~5mins
@romannurik
romannurik / duplicate-components.scripter.ts
Last active February 24, 2022 16:08
Figma + Scripter scripts
// Makes a copy of all selected components (how is this not built into Figma?)
let newSelection = [];
for (let component of figma.currentPage.selection.filter(node => node.type == 'COMPONENT')) {
let clone = component.clone()
clone.x += clone.width;
newSelection.push(clone);
}
figma.currentPage.selection = newSelection;
@nuhuo08
nuhuo08 / shadowsocks_ubuntu1604.org
Created March 11, 2019 09:44
Install Shadowsocks-libev + simple-obfs on Ubuntu 16.04

Install Shadowsocks-libev + simple-obfs on Ubuntu 16.04

Install shadowsocks-libev via Ubuntu PPA

sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:max-c-lv/shadowsocks-libev -y
sudo apt-get update
sudo apt install shadowsocks-libev
@astoilkov
astoilkov / readme.md
Last active November 16, 2024 12:52
Async Operations with useReducer Hook

Async Operations with useReducer Hook

9 March, 2019

We were discussing with @erusev what we can do with async operation when using useReducer() in our application. Our app is simple and we don't want to use a state management library. All our requirements are satisfied with using one root useReducer(). The problem we are facing and don't know how to solve is async operations.

In a discussion with Dan Abramov he recommends Solution 3 but points out that things are fresh with hooks and there could be better ways of handling the problem.

Problem

@chukaofili
chukaofili / heapster-influxdb-grafana.yaml
Last active January 20, 2023 09:10
heapster-influxdb-grafana
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: monitoring-influxdb
namespace: kube-system
spec:
replicas: 1
template:
metadata:
labels:
@soderlind
soderlind / Install.txt
Last active September 7, 2024 05:45
macOS DoH! (DNS over HTTPS) using cloudflared
1) Install cloudflared using homebrew:
brew install cloudflare/cloudflare/cloudflared
2) Create /usr/local/etc/cloudflared/config.yaml, with the following content
proxy-dns: true
proxy-dns-upstream:
- https://1.1.1.1/dns-query
- https://1.0.0.1/dns-query
@germanescobar
germanescobar / evaluator-service.md
Last active September 15, 2019 11:56
Instructions for the creation of a code evaluation service

Code Evaluator Service

The goal of this project is to create and publish an API that allows users to evaluate code in different programming languages using isolated Docker containers.

Use cases for this project include an online IDE for pair programming, a remote interview tool and evaluation of challenges (like Make it Real), among others.

Before using this service users have to sign up so that they can grab a generated API Key that they have to use to authenticate the requests.

Assuming that the service is published in the domain http://eval.io/, it should be posible to make a POST to the path /v1/eval/<platform> where <platform> is one of the languages or platforms supported.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?