Skip to content

Instantly share code, notes, and snippets.

View pyadav's full-sized avatar
⛏️
learning new stuff

Praveen Yadav pyadav

⛏️
learning new stuff
View GitHub Profile
@kordless
kordless / README.md
Last active January 1, 2024 11:19
Example of using OpenAI functions in completions with Python decorators.

Example of using OpenAI functions in completions with Python decorators

This example illustrates a way to utilize a function dynamically while querying an OpenAI GPT model. It uses the newly released functions support in the completion endpoints OpenAI provides.

The general concept is based on using a decorator to extract information from a function so it can be presented to the language model for use, and then pass the result of that function back to the completion endpoint for language augmentation.

In general, a wide variety of functions can be swapped in for use by the model. By changing the get_top_stories function, plus the prompt in run_conversation, you should be able to get the model to run your function without changing any of the other code.

Configuration

To use this, create a config.py file and add a variable with your OpenAI token:

@ivanbanov
ivanbanov / bundlers.md
Last active June 17, 2023 15:06
Bundlers comparison
Rollup SWC esbuild tsup Vite Parcel Webpack
Monorepo support ⛔️ ⛔️ ⛔️ ⛔️ ⛔️ ⛔️
Performance esbuid/swc esbuid/swc esbuid/swc esbuid/swc esbuid/swc
Type declaration (.d.ts) rollup-plugin-dts ⛔️ ⛔️ rollup-plugin-dts rollup-plugin-dts ts-loader
Declaration map (.d.ts.map) ⛔️ ⛔️ ⛔️ ⛔️ ⛔️ ts-loader
Treeshaking esbuild + rollup esbuild + rollup
Type-check
#include <WiFi.h>
#include <esp_wpa2.h>
#include <esp_wifi.h>
#include <time.h>
#include <InfluxDbClient.h> // https://github.com/tobiasschuerg/InfluxDB-Client-for-Arduino
#include <Wire.h>
#include <Adafruit_BME280.h> // https://github.com/adafruit/Adafruit_BME280_Library
#define HOSTNAME "ESP32 Temperature Sensor"
#define LOCATION "1000 chem"
@45deg
45deg / _raytracing_on_bigquery.png
Last active April 29, 2021 02:47
Ray Tracing on BigQuery (for free of charge)
_raytracing_on_bigquery.png
@raysan5
raysan5 / custom_game_engines_small_study.md
Last active July 26, 2024 01:53
A small state-of-the-art study on custom engines

CUSTOM GAME ENGINES: A Small Study

a_plague_tale

A couple of weeks ago I played (and finished) A Plague Tale, a game by Asobo Studio. I was really captivated by the game, not only by the beautiful graphics but also by the story and the locations in the game. I decided to investigate a bit about the game tech and I was surprised to see it was developed with a custom engine by a relatively small studio. I know there are some companies using custom engines but it's very difficult to find a detailed market study with that kind of information curated and updated. So this article.

Nowadays lots of companies choose engines like Unreal or Unity for their games (or that's what lot of people think) because d

Bundling Design Systems/Component Libraries

First of all you need to decide who will be your target consumers based on the following:

  1. They have the same environment(webpack config, babel config) setup as you where you built your design system(this is mostly possible if you use monorepos/same configs where all the teams share the same environment).

  2. They don't have the same environment which is the case when you work in bigger teams and you want to distribute your design system as any other npm package which is already built and can be used directly.

If your use case falls under case no. 1 then you can just compile the source babel src -d build and leave the bundling to the consumer projects tools(webpack/rollup)

@iexa
iexa / python-with-tcl.rb
Last active July 20, 2021 05:35
MacOS homebrew python 3.8.6 with tcl-tk (properly)
class Python < Formula
desc "Interpreted, interactive, object-oriented programming language"
homepage "https://www.python.org/"
url "https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz"
sha256 "a9e0b79d27aa056eb9cce8d63a427b5f9bab1465dee3f942dcfdb25a82f4ab8a"
head "https://github.com/python/cpython.git"
license "Python-2.0"
revision 1
bottle do
@danwild
danwild / d3-path-animation.html
Last active April 19, 2024 08:28
D3 animate dashed paths to represent flow
<!--https://stackoverflow.com/a/39731911/1177832-->
<!DOCTYPE html>
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.js"></script>
<style>
.node {
fill: #dddddd;
stroke: gray;
@muralikg
muralikg / background.js
Last active July 29, 2024 14:29
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {
@jayphelps
jayphelps / package.json
Last active June 29, 2024 15:53
TypeScript output es2015, esm (ES Modules), CJS, UMD, UMD + Min + Gzip. Assumes you install typescript (tsc), rollup, uglifyjs either globally or included as devDependencies
{
"scripts": {
"build": "npm run build:es2015 && npm run build:esm && npm run build:cjs && npm run build:umd && npm run build:umd:min",
"build:es2015": "tsc --module es2015 --target es2015 --outDir dist/es2015",
"build:esm": "tsc --module es2015 --target es5 --outDir dist/esm",
"build:cjs": "tsc --module commonjs --target es5 --outDir dist/cjs",
"build:umd": "rollup dist/esm/index.js --format umd --name YourLibrary --sourceMap --output dist/umd/yourlibrary.js",
"build:umd:min": "cd dist/umd && uglifyjs --compress --mangle --source-map --screw-ie8 --comments --o yourlibrary.min.js -- yourlibrary.js && gzip yourlibrary.min.js -c > yourlibrary.min.js.gz",
}
}