Skip to content

Instantly share code, notes, and snippets.

View nachoal's full-sized avatar
:shipit:
Shipping 🚢

Ignacio Alonso nachoal

:shipit:
Shipping 🚢
View GitHub Profile
@nachoal
nachoal / t2c.zsh
Created December 9, 2024 11:37
Text-to-Command (t2c): Convert natural language to shell commands using Ollama LLMs A zsh function that converts natural language queries into shell commands using Ollama's local API. Ask for commands in plain English, review them before execution. Customizable to use any Ollama model. Example: t2c list all python files modified in the last week
# Function to convert natural language queries into Unix commands using Ollama's API
# Usage: t2c list files in current folder
# Requirements: curl, jq, and Ollama running locally on port 11434
t2c() {
# Store the entire command argument as the user's query
user_query="$*"
# Construct the prompt for the LLM to convert the query to a command
# The prompt specifically requests a single executable Unix command
@nachoal
nachoal / flux_lora_cfg.py
Created September 11, 2024 21:29 — forked from AmericanPresidentJimmyCarter/flux_lora_cfg.py
Use your flux-dev LoRA with a quantized model and CFG in <16gb VRAM
import inspect
from typing import Any, Callable, Dict, List, Optional, Union
import numpy as np
import torch
from transformers import CLIPTextModel, CLIPTokenizer, T5EncoderModel, T5TokenizerFast
from diffusers.image_processor import VaeImageProcessor
from diffusers.loaders import FluxLoraLoaderMixin
from diffusers.models.autoencoders import AutoencoderKL
@nachoal
nachoal / full-page-screenshots-selenium-chrome.rb
Created May 26, 2021 20:06 — forked from elcamino/full-page-screenshots-selenium-chrome.rb
How to take full-page screenshots with Selenium and Google Chrome in Ruby
#!/usr/bin/env ruby
require 'selenium-webdriver'
wd = Selenium::WebDriver.for :remote, url: 'http://10.3.1.7:4444/wd/hub', desired_capabilities: :chrome
wd.navigate.to 'https://snipt.net/restrada/python-selenium-workaround-for-full-page-screenshot-using-chromedriver-2x/'
# Get the actual page dimensions using javascript
#
width = wd.execute_script("return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);")
@nachoal
nachoal / SETUP_DAY.md
Created April 29, 2021 13:22
Starting my coding journey...
@nachoal
nachoal / template_test.rb
Last active February 19, 2021 16:38
a test for a rails template
# Kill spring if its running
run "if uname | grep -q 'Darwin'; then pgrep spring | xargs kill -9; fi"
#################################### GEMFILE ###################################
gsub_file './Gemfile', /(^ $|# .+$)/, ''
gsub_file './Gemfile', /^\n/, ''
gsub_file './Gemfile', /^ $/, ''
gsub_file './Gemfile', /^\n/, ''
gsub_file './Gemfile', /^ruby.+$/, "\nruby '#{RUBY_VERSION}'"
gsub_file './Gemfile', /^gem 'rails'.+$/, "\n# Base\ngem 'rails', '~> #{Rails.version}'"
@nachoal
nachoal / get_a_job.md
Created July 8, 2020 20:02
Presentation
title tags description
How to get a job after a coding bootcamp
Talk, jobs, development
What to do to get a job after a coding bootcamp

How to get a job after a coding bootcamp!

Tips and tricks

Learning Programming in the post-Wagon blues

The most general and important advice I can give you is: build things. If you're practicing by yourself, find a problem you want to solve. Be it a page component you're interested in (a navbar that hides on a threshold) or an entire, but simple, app (a downscaled Evernote clone), it's important to have clear goals and to be able to see the results of your work.

Courses

I'll suggest only one thing here...:

@nachoal
nachoal / rails_new_help_output.md
Created November 4, 2019 03:04 — forked from eliotsykes/rails_new_help_output.md
"rails new" options explained

Run rails new --help to view all of the options you can pass to rails new:

$ bin/rails new --help
Usage:
  rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]                                      # Path to the Ruby binary of your choice
                                                         # Default: /Users/eliot/.rbenv/versions/2.2.0/bin/ruby
require 'mail'
require 'csv'
password = 'AQUI TU CONTRASEÑA'
user = "AQUI TU CORREO (gmail)"
csv_options = { col_sep: ',', quote_char: '"', headers: :first_row }
filepath = 'correos.csv'
options = {
address: 'smtp.gmail.com',
port: 587,
user_name: user,