Skip to content

Instantly share code, notes, and snippets.

@jimwhite
jimwhite / gist:bc44ad2e3e1b4647afd2d5c4de87ccb6
Last active February 19, 2024 07:53
Quickstart for running Python using NixOS flox.dev in Docker
# Run Docker image with NixOS and flox:
# https://flox.dev/docs/install-flox/
# docker run --pull always --rm -it ghcr.io/flox/flox
docker run -it ghcr.io/flox/flox
# Then in that shell:
# flox config --set-bool disable_metrics true
cd ~
flox init
flox install python311Packages.python
@jimwhite
jimwhite / fetch_news.py
Last active January 11, 2024 03:56
Fetch history news using Alpaca API, raw JSON format, one article per file
import os
import json
from datetime import datetime, timezone
import time
import argparse
from alpaca.data.historical.news import NewsClient
from alpaca.data.requests import NewsRequest
from alpaca.data.timeframe import TimeFrame
@jimwhite
jimwhite / llama_example.ipynb
Created December 26, 2023 23:02
llama_example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jimwhite
jimwhite / gist:7866da091ddd56e5ba4a485a0295f7da
Last active October 31, 2023 23:06
Bard's code naming style guide
When naming variables in code, you can follow these best practices:
Descriptive: Choose names that are easy to remember.
Concise: Use clear and concise names.
A longer name needs to earn its length vs a shorter one by being more informative.
Lowercase: Use lowercase letters.
Underscores: Use underscores to separate words in a name.
No spaces: Avoid using spaces in names.
No special characters: Avoid using special characters.
No acronyms: Avoid using acronyms and abbreviations.
No conflicts: Avoid names that could be confused with keywords or built-in functions.
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
namespace Shape.Lib
{
internal class Utils
{
public static Func<int?, dynamic> CreateDynamicColorSelector(Func<dynamic> defaultColorSelector, Func<int?, dynamic> customColorSelector) { dynamic colorSelector(int? v) { if (v == null) { return defaultColorSelector(); } return customColorSelector(v); } return colorSelector; }
@jimwhite
jimwhite / rule_one_image_descriptions.txt
Created July 16, 2023 03:52
ChatGPT image descriptions for Hacker Dojo Rule #1
Sure, here are some creative prompts that you could use to generate images or videos for the Hacker Dojo's motto "RULE# 1: BE EXCELLENT TO EACH OTHER."
1. "An intricately designed digital circuit board where the circuits spell out 'RULE# 1: BE EXCELLENT TO EACH OTHER'."
2. "A group of diverse people, representing different ethnicities, genders, and ages, all working together on a complex tech project. Superimposed above them are glowing, futuristic letters stating 'RULE# 1: BE EXCELLENT TO EACH OTHER'."
3. "A large, welcoming entrance to a modern, industrial-style building labeled 'Hacker Dojo'. Above the entrance, in bold neon lights, shines the phrase 'RULE# 1: BE EXCELLENT TO EACH OTHER'."
4. "A pair of hands typing on a keyboard with binary code streaming from it. The binary code transforms into the words 'RULE# 1: BE EXCELLENT TO EACH OTHER'."
#!/bin/bash
find /input_files ! -regex '/input_files/_exceptions.*' -print | head -n 1000 >/outputs/filelist.txt
skilldb % python skilldb.py
No embedding_function provided, using default embedding function: DefaultEmbeddingFunction https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2
hhh: agent_executor.run...
> Entering new AgentExecutor chain...
hhh: SkilledAgent...
{
"tasks": [
{
@jimwhite
jimwhite / llm_jokes.html
Created April 20, 2023 14:10
GPT-4: Be my web site coder. Please generate 10 funny jokes about LLMs and put them in a HTML page with suitable title and a button that shows a random joke from those 10 when pressed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LLM Laughs: Hilarious Jokes About Large Language Models</title>
<style>
body {
font-family: Arial, sans-serif;
}
@jimwhite
jimwhite / MultipleIteratorDemo.groovy
Last active August 29, 2015 14:12
PoC for iterating over multiple collections in Groovy
// Example of an iterator that works over a sequence of multiple collections.
def a = [1, 2]
def b = [3, 4]
def c = new CollectionSequence(a, b)
// The elements of the collections look like one concatenated list.
println (c as List)
// Mutating the elements of one of the collections changes what we get.