Skip to content

Instantly share code, notes, and snippets.

View IanCal's full-sized avatar

Ian Calvert IanCal

  • Red Bird Data
  • Wirral
View GitHub Profile
@IanCal
IanCal / solve.py
Created July 4, 2023 10:58
LLM generated sudoku solver
def find_empty(grid):
for i in range(9):
for j in range(9):
if grid[i][j] == 0:
return i, j # row, column
return None # no empty spaces in the grid
def is_valid(grid, num, pos):
# Check if num is already in the row or column
for i in range(9):
@IanCal
IanCal / Chat.md
Created March 5, 2023 13:05
Maths research?

Maths Research Process

Model: Default

Me: You are MR R the Maths Researching Robot. Your goal is to do fundamental maths research. How do humans do maths research at a high level?

To do fundamental maths research at a high level, humans typically follow a few key steps:

import pyarrow.flight as fl
import json
client = fl.FlightClient("grpc://127.0.0.1:8815")
print(
client.do_get(
fl.Ticket(json.dumps({"contract": "0x", "event": "0x"}))
).read_pandas()
)
from pyarrow import csv
import pyarrow.parquet as pq
table = csv.read_csv("BasicCompanyDataAsOneFile-2022-09-01.csv")
sorted_table = table.sort_by([("CompanyName", "ascending")])
pq.write_table(sorted_table, "basic_company_data_sorted.parquet")
import streamlit as st
import streamlit.ReportThread as ReportThread
from streamlit.server.Server import Server
import pandas as pd
import json
import time
def trigger_rerun():
ctx = ReportThread.get_report_ctx()
import streamlit as st
import streamlit.ReportThread as ReportThread
from streamlit.server.Server import Server
import pandas as pd
import json
import time
def trigger_rerun():
ctx = ReportThread.get_report_ctx()
@IanCal
IanCal / lru_mutable_results.py
Created May 15, 2019 10:59
Be careful with lru_cache in python
from functools import lru_cache
@lru_cache(1)
def cached():
return ["Do cached entries safely return the same thing?"]
def uncached():
return ["Do cached entries safely return the same thing?"]
@IanCal
IanCal / test_case.sh
Created February 13, 2019 13:13
A minimal example of DVC not using the cache
#!/bin/bash
set -ex
rm -rf test_example
mkdir test_example
cd test_example
echo "Setup DVC"
dvc init --no-scm
@IanCal
IanCal / keybase.md
Created February 12, 2018 14:01
Keybase Proof

Keybase proof

I hereby claim:

  • I am iancal on github.
  • I am iancal (https://keybase.io/iancal) on keybase.
  • I have a public key ASDqDUUQp5o9mLTRp9oUwU1_XKEziIE1rnORdtAgHteCbAo

To claim this, I am signing this object:

@IanCal
IanCal / monty_hall_variations.py
Last active December 29, 2016 00:16
Monty hall variations in strategy
from random import randint, shuffle
from collections import Counter
DOORS = 3
EXPERIMENTS = 1000
def get_doors():
doors = [True] + [False] * (DOORS - 1)
shuffle(doors)
return doors