Skip to content

Instantly share code, notes, and snippets.

@darkseed
darkseed / llama-index_starter_dbrx.py
Created April 10, 2024 07:25 — forked from dennyglee/llama-index_starter_dbrx.py
Llama_Index Starter Example using DBRX
#
# LlamaIndex Starter Example with DBRX
#
# Based on the LlamaIndex Starter Example
# https://docs.llamaindex.ai/en/stable/getting_started/starter_example/
#
# Ensure you have installed both llama_index and Databricks integration
# e.g., pip install llama_index llama-index-llms-databricks
#
@darkseed
darkseed / dispatch_openai_requests.py
Created April 23, 2023 19:00 — forked from neubig/dispatch_openai_requests.py
A simple script to get results from the OpenAI Asynchronous API
import openai
import asyncio
from typing import Any
async def dispatch_openai_requests(
messages_list: list[list[dict[str,Any]]],
model: str,
temperature: float,
max_tokens: int,
top_p: float,
@darkseed
darkseed / Reachability.h
Created August 30, 2011 23:16 — forked from dhoerl/Reachability.h
Reachability (iOS) ARCified
/*
File: Reachability.h
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 2.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
@darkseed
darkseed / readme.md
Created November 24, 2021 15:08 — forked from ChipCE/readme.md
Klipper bed mesh on print area only macro install guide

Klipper mesh on print area only install guide

What this macro do

  • This macro will dymanic change the bed_mesh area based on the size of the printed part. The fw will only probe on the area that the part will be printed (plus mesh_area_offset value)

Setup guide

  • (1) Add the following macrro to your printer config, this will replace the default BED_MESH_CALIBRATE command.
@darkseed
darkseed / psextendscriptexample.js
Created September 29, 2011 13:25 — forked from aral/psextendscriptexample.js
Using ExtendScript to save out multiple resolution images from Photoshop (with unsharp mask)
/*
The original files are 960x319.
Image sizes to save:
* 800x266 - Retina for 480x320 resolution (400 logical pixel wide panel areas)
* 740x246 - Desktop and iPad
* 616x205 - Retina for 320x480 resolution (308 logical pixel wide panel areas)
* 400x133 - 480x320 resolution
* 308x102 - 320x480 resolution
@darkseed
darkseed / knapsack_problem.scala
Created July 11, 2016 12:29 — forked from bmarcot/knapsack_problem.scala
The Knapsack Problem, in Scala -- Keywords: dynamic programming, recursion, scala.
def knapsack_aux(x: (Int, Int), is: List[Int]): List[Int] = {
for {
w <- is.zip(is.take(x._1) ::: is.take(is.size - x._1).map(_ + x._2))
} yield math.max(w._1, w._2)
}
def knapsack_rec(xs: List[(Int, Int)], is: List[Int]): List[List[Int]] = {
xs match {
case x :: xs => knapsack_aux(x, is) :: knapsack_rec(xs, knapsack_aux(x, is))
case _ => Nil
# coding=UTF-8
from __future__ import division
import nltk
import re
import requests
# Add your freebase key here
# If you don't have one, register at https://code.google.com/apis/console
FREEBASE_KEY = ""
@darkseed
darkseed / brnn.py
Created December 5, 2017 15:40 — forked from windweller/brnn.py
Bayesian Recurrent Neural Network Implementation
"""
An implementation of the `Local reparameterization trick`
from Kingma & Wellings and
Bayesian RNN
from Fortunato, Blundell & Vinyals
"""
import os
import time
import copy
from os.path import join as pjoin
@darkseed
darkseed / README.rst
Created August 15, 2017 13:17 — forked from honzakral/README.rst
CLI for elaasticsearch-py helpers

Elasticsearch CLI

Experimental CLI interface for the helpers in the python library.

Main purpose is to expose the bulk functionality to enable rapid loading of data into an elasticsearch cluster. Combined with the scan command it can also be used to reindex data from elasticsearch into a different index or cluster.