Skip to content

Instantly share code, notes, and snippets.

@jgonera
jgonera / test.py
Created February 28, 2025 17:59
mistral.rs test
import base64
import requests
def encode_image_to_base64(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')
def perform_ocr(image_path):
base64_image = encode_image_to_base64(image_path)
response = requests.post(
@jgonera
jgonera / Dockerfile
Created February 28, 2025 17:58
mistral.rs Dockerfile + Cloud Build
FROM nvidia/cuda:12.4.1-devel-ubuntu22.04 AS builder
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
curl \
libssl-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
@jgonera
jgonera / words
Created March 9, 2023 19:40
/usr/share/dict/words
This file has been truncated, but you can view the full file.
A
a
aa
aal
aalii
aam
Aani
aardvark
aardwolf
Aaron
@jgonera
jgonera / markdown-details-collapsible.md
Created March 1, 2023 02:54 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

How to

<details>
  <summary>## Click me</summary>
  
  ### Heading
  1. Foo
  2. Bar
     * Baz
 * Qux
"""
Generates per-file-ignores section for the .flake8 configuration file based on
flake8 run output (can be either piped using STDIN or read from the file as the
first argument to this script).
Use this to disable some linting in legacy code, but keep full linting for
newly written code.
"""
import fileinput
@jgonera
jgonera / vanguard-csv.js
Last active August 22, 2022 17:49
Save Vanguard activity (beyond last 18 months) as a CSV.
var timer = setInterval(() => {
document.getElementById('account-0-showMoreLink').click();
}, 1000);
clearInterval(timer);
function parse() {
const results = [];
document.querySelectorAll('#account-0-transaction-table > tbody > tr').forEach((node) => {
@jgonera
jgonera / robinhood-csv.js
Last active June 5, 2021 16:10
Save Robinhood transaction history as a CSV.
// This is a naive HTML scraper, using the API might be a better idea (https://medium.com/@bartclaeys/how-to-export-your-robinhood-stocks-fc8245b3d118)
var timer = setInterval(() => {
window.scrollTo(0,document.body.scrollHeight);
}, 1000);
clearInterval(timer);
function parse() {
const results = [];
// without TypeScript (not tested)
module.exports = {
root: true,
extends: [
'airbnb',
'airbnb/hooks',
'plugin:import/errors',
'plugin:import/warnings',
'prettier',
'prettier/react',
function googleCalendarHoliday() {
var fromDate = new Date('2017-12-19T00:00:00-08:00');
var toDate = new Date('2018-01-01T23:30:00-08:00');
var calendarId = "your@gmail";
//Logger.log(CalendarApp.getAllCalendars().map(function(c) { return c.getId() }));
var calendar = CalendarApp.getCalendarById(calendarId);
var events = calendar.getEvents(fromDate, toDate);
Logger.log('Events: ' + events.length);
for (var i = 0; i < events.length; i++) {

Dependency mess in Ruby gems

I decided to follow up on my email about requires vs. autoload in Ruby. I thought I'd do more research to figure out how to best manage requiring code in a Ruby gem. I decided to take a look at a few popular Ruby projects to get inspired.

The results are... not inspiring.

Projects

Bundler