Skip to content

Instantly share code, notes, and snippets.

View rogeruiz's full-sized avatar
🚧
socorro, estoy enquevado dentro el internet

Roger Steve Ruiz rogeruiz

🚧
socorro, estoy enquevado dentro el internet
View GitHub Profile
@rogeruiz
rogeruiz / .00-usando-bubble-tea-para-front-end.md
Last active April 7, 2025 17:51
Un demo simple de Bubble Tea un la biblioteca para aplicaciones con interfaz de terminal (TUI)
@rogeruiz
rogeruiz / jq.md
Created March 19, 2025 13:06 — forked from jwbee/jq.md
Make Ubuntu packages 90% faster by rebuilding them

Make Ubuntu packages 90% faster by rebuilding them

TL;DR

You can take the same source code package that Ubuntu uses to build jq, compile it again, and realize 90% better performance.

Setting

I use jq for processing GeoJSON files and other open data offered in JSON format. Today I am working with a 500MB GeoJSON file that contains the Alameda County Assessor's parcel map. I want to run a query that prints the city for every parcel worth more than a threshold amount. The program is

@rogeruiz
rogeruiz / demo.ts
Created December 22, 2024 13:32 — forked from vedantroy/demo.ts
SQLite-backed key-value store with JS-like object manipulation and automatic JSON serialization.
import Database from 'better-sqlite3';
import { createDatabaseClient } from 'my-partial-db-lib';
// 1) Create an in-memory DB and your table(s).
const db = new Database(':memory:');
db.exec(`
CREATE TABLE users (
id TEXT PRIMARY KEY,
data JSON
);
@rogeruiz
rogeruiz / fijar_tema.ps1
Last active December 13, 2024 19:24
Es útil pa' cambiar varias configuraciones de varias aplicaciones usando PowerShell.
$luna = [char]::ConvertFromUtf32(0x1F31D)
$sol = [char]::ConvertFromUtf32(0x1F31E)
$murcielago = [char]::ConvertFromUtf32(0x1F987)
$nota = [char]::ConvertFromUtf32(0x1F4DD)
$cohete = [char]::ConvertFromUtf32(0x1F680)
$concha = [char]::ConvertFromUtf32(0x1F41A)
$error = [char]::ConvertFromUtf32(0x274C)
$marco = [char]::ConvertFromUtf32(0x1F5BC)
$exito = [char]::ConvertFromUtf32(0x2705)
@rogeruiz
rogeruiz / game.sh
Created October 13, 2024 23:11
Word Guess IT game Sept 20 2023
#!/bin/bash
# 1. Find out the number of words in the word file
number_of_words=$(wc -l < ./word-list.txt)
# 2. Pick a random word from the list
pick_random_number=$((1 + RANDOM % number_of_words))
# 3. Pick the line from the word list that is the random number
the_word=$(sed "${pick_random_number}q;d" ./word-list.txt)
@rogeruiz
rogeruiz / nowplaying-cli.sh
Created September 9, 2024 20:15
This is an example script that uses `nowplaying-cli` to extract things without needing `jq`
#!/bin/bash
generic_prefix='kMRMediaRemoteNowPlayingInfo'
apple_prefix='MRMediaRemoteMediaType'
# Requires Bash 4+ due to associative array usage in this script.
declare -A npc_response=(
[artist]='null'
[title]='null'
[album]='null'
@rogeruiz
rogeruiz / XDG.cheat-sheet.md
Created February 24, 2024 00:34 — forked from roalcantara/XDG.cheat-sheet.md
XDG cheat sheet

XDG - Base Directory Specification

Directories

Base

The intended use-case for BaseDirectories is to query the paths of user-invisible standard directories that have been defined according to the conventions of the operating system the library is running on.

@rogeruiz
rogeruiz / customSelect.js
Created March 11, 2014 17:42
Custom Select AMD Module
define(function (require) {
var $ = require('jquery');
var $el = $('.js-custom-select');
var numEl = $el.length;
// Check if module should run.
if (!numEl) { return false; }
// Proceed with module execution
if ($el.data('map')) {
@rogeruiz
rogeruiz / randuh.js
Last active December 14, 2023 00:41
Now for something completely random
const MAX = 39;
const MIN = 33;
const COUNT = 200;
const nn = new Array(COUNT).fill();
/**
* @param {any[]} a - An array to be used to create a new array of random
* values. The contents of the array is not modified.
* @returns {number[]} - An array of the same length passed in with random
* numbers at each index
@rogeruiz
rogeruiz / gruvbox-material-alacritty.yml
Created September 19, 2023 13:05 — forked from ttys3/gruvbox-material-alacritty.yml
Gruvbox Material for Alacritty
# The definition of color schemes.
schemes:
gruvbox_material_hard_dark: &gruvbox_material_hard_dark
primary:
background: '0x1d2021'
foreground: '0xd4be98'
normal:
black: '0x32302f'
red: '0xea6962'
green: '0xa9b665'