Skip to content

Instantly share code, notes, and snippets.

View didmar's full-sized avatar

Didier Marin didmar

View GitHub Profile
@didmar
didmar / gist:4e0234f313c13f68ac3bc760fef5e3e0
Last active May 11, 2024 14:26
Shell script to extract text from last screenshot taken
#!/bin/sh
# This script opens the last screenshot taken and runs OCR on it to extract text.
# It used tesseract (see https://tesseract-ocr.github.io/)
# Configured with Ubuntu's Screenshots folder. Change to your own.
SCREENSHOTS_DIR=$HOME/Pictures/Screenshots
# Create the folder to put the output into, if needed
mkdir -p $SCREENSHOTS_DIR/ocr_output
@didmar
didmar / iter_exec.py
Created April 28, 2023 06:47
IterativeAgentExecutor (LangChain)
"""
Modified langchain.agents.AgentExecutor that runs one step at a time. (Based on langchain 0.0.147)
See the example usage in main() at the bottom of this file.
"""
import time
from typing import Dict, Any, List, Union, Tuple, Iterator
from langchain.agents import AgentExecutor, ZeroShotAgent
from langchain.input import get_color_mapping
from langchain.llms.fake import FakeListLLM
### Keybase proof
I hereby claim:
* I am didmar on github.
* I am didmar (https://keybase.io/didmar) on keybase.
* I have a public key ASCrIhT6oH3n7LdamwDGw7O-M13MXQS1I-DBPu0ybD2eIwo
To claim this, I am signing this object:
@didmar
didmar / readme.txt
Created October 1, 2022 13:05
Snake Corrida (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@didmar
didmar / uninstall_nix.sh
Last active September 14, 2022 13:08
Script to uninstall Nix from Ubuntu, tested with Ubuntu 22.04
#!/bin/sh
# Uninstall Nix, tested with Ubuntu 22.04
# For your .bashrc and .zshrc, manually edit them to remove Nix related lines
for i in {1..32}; do sudo userdel nixbld${i}; done
sudo groupdel nixbld
sudo rm -rf /etc/nix /nix /var/root/.nix-profile /var/root/.nix-defexpr /var/root/.nix-channels \
@didmar
didmar / readme.txt
Last active December 29, 2021 16:33
Snake Corrida (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
## Shell command aliases for Docker
dockerip() {
# Get container ip
docker inspect --format '{{ .NetworkSettings.IPAddress }}' $1
}
dockerkillall() {
printf "\n>>> Kill all running containers\n\n" && docker kill $(docker ps -q)
}
dockercleanc() {
#!/bin/sh
# Runs the given command and notifies you through Slack when its done !
# You must first create a slack hook and set your username
URL="https://hooks.slack.com/services/T000000000/B0000000/xxxxxxxxxxxxxxx"
USERNAME="@your_user_name_here"
COMMAND=$*
$COMMAND
RET=$?