Skip to content

Instantly share code, notes, and snippets.

View agucova's full-sized avatar
👋
Hi there!

Agustín Covarrubias agucova

👋
Hi there!
View GitHub Profile
set remindersOpen to application "Reminders" is running
set todoistToken to "<YOUR_TOKEN_HERE>"
set apiCall to "curl https://api.todoist.com/sync/v9/quick/add"
set listOfCommands to {}
tell application "Reminders"
// Clean and simplify HTML
function cleanHTML(html: string): string {
const div = document.createElement('div');
div.innerHTML = html;
// Remove all class attributes and data-* attributes
div.querySelectorAll('*').forEach(el => {
el.removeAttribute('class');
Array.from(el.attributes).forEach(attr => {
if (attr.name.startsWith('data-')) {
@agucova
agucova / to_webp.py
Created September 30, 2023 00:11
Script for converting <img> references in an Anki CSV to inline webp images.
#!/usr/bin/env python3
import typer
import pandas as pd
import requests
import base64
from bs4 import BeautifulSoup
from PIL import Image
from io import BytesIO
from typing import Optional
@agucova
agucova / dist_refactor.py
Last active June 13, 2023 23:37
Automated libCST refactor for squigglepy
import libcst as cst
from libcst.codemod import CodemodTest, VisitorBasedCodemodCommand
from libcst.codemod.visitors import AddImportsVisitor
DISTS: dict[str, str] = {
"base": "BaseDistribution",
"complex": "ComplexDistribution",
"const": "ConstantDistribution",
"uniform": "UniformDistribution",
@agucova
agucova / test.bash
Created April 14, 2023 19:50
Script para testear proyecto completo de VHDL
#!/usr/bin/env bash
set -uo pipefail
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
IFS=$'\n\t'
# Run syntax check
echo "Checking syntax..."
nvc --std=2008 --syntax lib/**/*.vhd
nvc --std=2008 --syntax test/**/*.vhd
[flake8]
max-line-length = 88
extend-ignore = E203, W503, E501
exclude =
# No need to traverse our git directory
.git,
# There's no value in checking cache directories
__pycache__,
# This contains our built documentation
build,
+(/Users/agucova/.pyenv/bin/pyenv:23): enable -f /Users/agucova/.pyenv/bin/../libexec/pyenv-realpath.dylib realpath
+(/Users/agucova/.pyenv/bin/pyenv:30): '[' -z '' ']'
++(/Users/agucova/.pyenv/bin/pyenv:32): type -P greadlink readlink
++(/Users/agucova/.pyenv/bin/pyenv:32): head -1
+(/Users/agucova/.pyenv/bin/pyenv:32): READLINK=/opt/homebrew/bin/greadlink
+(/Users/agucova/.pyenv/bin/pyenv:33): '[' -n /opt/homebrew/bin/greadlink ']'
+(/Users/agucova/.pyenv/bin/pyenv:58): '[' -z /Users/agucova/.pyenv ']'
+(/Users/agucova/.pyenv/bin/pyenv:61): PYENV_ROOT=/Users/agucova/.pyenv
+(/Users/agucova/.pyenv/bin/pyenv:63): export PYENV_ROOT
+(/Users/agucova/.pyenv/bin/pyenv:65): '[' -z '' ']'
@agucova
agucova / requirements.md
Last active July 22, 2021 19:25
Technical requirements for Reguleque

Currently our setup for our search engine is merely an InstantSearch front-end to an open-source engine called TypeSense. We made specialized scripts to clean and load the government transparency data into the Typesense instance.

Currently, the front-end is public and has unlimited usage, but we want to limit the daily searches available for each visitor (similar to newspaper paywalls), while still allowing people to request a fair use account (for journalists, by example).

Technically this means:

  • Implement a back-end that acts as a proxy to the search requests to Typesense and checks for user authentication. This needs to implement full-fledged user management under reasonable security standards, preferabily implemented through existing authentication solutions or libraries.
  • Modifying the InstantSearch-ba
#
# .zshrc is sourced in interactive shells.
# It should contain commands to set up aliases,
# functions, options, key bindings, etc.
#
autoload -U compinit
compinit
#allow tab completion in the middle of a word
#include <packets.pb.h>
#include <pb_encode.h>
#include <pb_decode.h>
// Solo el codigo relevante
byte packet[512];
size_t packet_length;
{