Skip to content

Instantly share code, notes, and snippets.

@zby
zby / dyson_fission.py
Created September 27, 2024 21:25
Dyson sphere contra fission reactors
import math
# Constants
SUN_RADIUS = 696340000 # meters
SUN_POWER = 3.828e26 # watts
DYSON_SPHERE_THICKNESS = 1 # meter
DYSON_SPHERE_STANDOFF = 5 # meters
METAL_DENSITY = 7874 # kg/m^3 (assuming iron)
NUCLEAR_PLANT_POWER = 1000e6 # watts (1000 MW, typical large nuclear plant)
NUCLEAR_PLANT_MASS = 200000000 # kg (estimated mass of a nuclear power plant)
@zby
zby / gist:e8a0652b196068f1492f68ff79fee31e
Created August 12, 2024 10:48
testing a frewsh checkout of litellm
(test_env) zby@zby-Z4:~/llm/litellm$ pip install -e .
Obtaining file:///home/zby/llm/litellm
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... done
Preparing editable metadata (pyproject.toml) ... done
Collecting importlib-metadata>=6.8.0
Downloading importlib_metadata-8.2.0-py3-none-any.whl (25 kB)
Collecting openai>=1.40.0
Downloading openai-1.40.3-py3-none-any.whl (360 kB)
@zby
zby / gist:838e7d8fb27051cfd063af0534ee596f
Created June 24, 2024 17:13
Answering question about AI Act
The answer to the question:"
How is transparency defined in the AI Act and what transparency requirements apply to low-risk Ai systems?
" is:
Transparency in the EU AI Act is not explicitly defined as a single concept. Instead, it is addressed through various obligations for providers and deployers of AI systems to ensure that users and affected individuals are informed about the nature and capabilities of the AI systems they interact with.
For AI systems that are not classified as high-risk (which could be considered lower-risk), the key transparency requirements include:
1. Informing users of AI interaction: Providers must ensure that AI systems intended to interact directly with natural persons inform people they are interacting with an AI system, unless it's obvious.
@zby
zby / gpt_google.py
Last active September 15, 2023 06:20
chatbot with google search
import requests
import json
from string import Template
#question = input("Enter your question: ")
question = "What was the first major battle in the Ukrainian War?"
# load the api key from a file
with open("config.json", "r") as f:
@zby
zby / object_detection_setup.sh
Last active July 26, 2021 08:57
Installation of Python TensorFlow Object Detection libs
# tested on Ubuntu 20.04 and 21.04
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
# UNZIP INSTALLATION
sudo apt-get -y install unzip
# PYTHON 3 INSTALLATION
@zby
zby / session-test
Created January 20, 2013 10:27
The referer changes correctly, but the session is first {} and then always: {:x nil}
(ns login-app.ex)
(use 'ring.middleware.session
'ring.util.response)
(defn handl [{session :session uri :uri headers :headers}]
(let [body
(str
"<html><body>"
session "<br>\n"
$ cat src/login_app/core.clj
(ns login-app.core)
(defn handler [request]
{:status 200
:headers {"Content-Type" "text/html"}
:body "Hello World"})
[ snip ]
sub frobnicate {
my( $self, $data ) = @_;
...
$self->twiddle( $data );
...
}
sub twiddle {
my( $self, $data ) = @_;
...
@zby
zby / gist:4509300
Last active December 10, 2015 23:28
while ( my $data = $self->next ) {
my $featues = Text::FeatureCount->new->analyze($data->{content});
sub frobnicate {
#...
my $dbh = MyApp->dbh;
#...
}
# or
sub frobnicate {
#...