Skip to content

Instantly share code, notes, and snippets.

View elecnix's full-sized avatar

Nicolas Marchildon elecnix

View GitHub Profile
Write a python program that reads a software spec prompt, writes a python implementation that satisfies this spec and a test suite, then runs the tests, inspects the test results, and re-generates the implementation & tests, runs the tests again, until all the tests pass.
The prompt can be passed as a string arg to the program, as a file name argument, or else read from standard input.
The program must invoke ollama to generate the implementation for the prompt. Use deepseek-coder.
The ollama model must decide whether the tests were successful, by reading the user's prompt, the code, and the test output.
The program should not keep all history of the iterations; instead, once it has a first implementation and test results, it should only add a "memory" file that it rewrites on each iteration, using a separate prompt that is aimed at "memorizing any learnings". The goal with this memory is to avoid overloading the context window of the LLM after hundreds of iterations.
The code generated by ollama will likely
"""
This module contains functions for estimating the cost of OpenAI's image recognition API.
https://platform.openai.com/docs/guides/vision
Usage:
import openai_vision_cost
cost = openai_vision_cost.estimate_image_cost(image_width, image_height, detail_level)
Generated with the help of ChatGPT:
@elecnix
elecnix / chatgpt-ocr.py
Created November 6, 2023 01:39
OCR with ChatGPT Plus
"""
OCR with ChatGPT Plus
Convert a bunch of image files into text, using Playwright to control your Chrome browser.
Prerequisites:
- Run `chrome --remote-debugging-port=9222`
- Log in to ChatGPT
- Select GPT-4
"""
@elecnix
elecnix / Vagrantfile
Created October 31, 2017 02:22
Beersmith Vagrant
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.ssh.forward_x11 = true
config.vm.provision "shell", path: "https://gist.githubusercontent.com/elecnix/dd31ee274c5e721ce42acd27412ad3f0/raw/dbf9c3fff720c2e8aa768bf8cb264ede37cedfe2/gistfile1.txt"
end
@elecnix
elecnix / gist:dd31ee274c5e721ce42acd27412ad3f0
Last active October 31, 2017 01:42
beersmith-on-ubuntu16.04.sh
wget -q https://s3.amazonaws.com/beersmith2-3/BeerSmith-2.3.12_amd64.deb
apt-get update
apt-get download libwebkitgtk-1.0-0 libwebkitgtk-1.0-common libjavascriptcoregtk-1.0-0
dpkg -i *.deb
@elecnix
elecnix / docker-compose.yml
Last active March 27, 2017 00:26
ErabliCompose
# Ce fichier sert à exécuter un collecteur, un dashboard, et une base de données InfluxDB.
#
# 1. git clone https://gist.github.com/51637af8e7bea6d4faf8471397e4b0e5.git erabliere
# 2. cd erabliere
# 3. git clone https://github.com/elecnix/ErabliCollecteur.git
# 4. git clone https://github.com/elecnix/ErabliDash.git
# 5. docker-compose up -d
# 6. Ouvrir http://localhost:3000/ pour ErabliDash
# 7. Ouvrir http://localhost:3001/ pour Grafana
#
#!/bin/bash
repos=$(ls ~/repos)
for repo in $repos ; do
if [ -d ~/repos/$repo/.hg ] ; then
echo -e "\e[93m$repo\e[0m"
hg --cwd ~/repos/$repo qseries -v -s
if [ -d ~/repos/$repo/intelebase/.hg ] ; then
hg --cwd ~/repos/$repo/intelebase qseries -v -s
fi
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<head>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.sparkline.js"></script>
<script type="text/javascript">
$(function() {
for (row = 0; row < 80; row++) {
var myvalues = [];
for (i = 0; i < 500; i++) {
#include "SparkIntervalTimer/SparkIntervalTimer.h"
//SYSTEM_MODE (MANUAL);
volatile int i = 0; // Variable to use as a counter volatile as it is in an interrupt
volatile boolean zero_cross = 0; // Boolean to store a "switch" to tell us if we have crossed zero
int AC_pin = D7; // Output to Opto Triac
int dim = 0; // Dimming level (0-128) 0 = on, 128 = 0ff
int inc = 1; // counting up or down, 1=up, -1=down
cat top-1m.csv | sed -e 's_.*,\(.*\)_echo | openssl s\_client -connect \1:443 > certs/\1.pem\&_' > certs.sh
bash certs.sh
ls certs | xargs -L1 -I DOMAIN echo 'openssl x509 -in certs/DOMAIN -text -noout > checks/DOMAIN.check' > checks.sh
bash checks.sh
cat top-1m.csv | sed -e 's#.*,\(.*\)#\1#'| xargs -n1 -P20 -I DOM grep -H 'Not After' checks/DOM.pem.check 2>/dev/null | cut -d ':' -f 1,3-|sed -e 's_checks/\(.*\).pem.check: \(.*\)_\1,\2_' > top-1m-expiry.csv