Skip to content

Instantly share code, notes, and snippets.

View cgimenes's full-sized avatar

Marcelo Gimenes de Oliveira cgimenes

View GitHub Profile
@cgimenes
cgimenes / launch.json
Created September 26, 2025 04:07
Common debug tasks
{
"configurations": [
{
"type": "pwa-node",
"name": "Specs",
"request": "launch",
"runtimeExecutable": "pnpm",
"runtimeArgs": ["run", "specs"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
@cgimenes
cgimenes / in_transaction.sql
Last active September 24, 2025 14:53
Check if inside a transaction
CREATE TEMPORARY TABLE a (b int) ON COMMIT DROP;
SELECT pg_current_xact_id_if_assigned() IS NOT NULL AS is_transaction;
-- source: https://dba.stackexchange.com/a/311714
@cgimenes
cgimenes / copy_volume.sh
Created July 5, 2025 22:23
Copy a Docker volume
docker volume create --name <new_volume>
docker run --rm -it -v <old_volume>:/from -v <new_volume>:/to alpine ash -c "cd /from ; cp -av . /to"
@cgimenes
cgimenes / impersonate.sql
Created March 13, 2025 00:03
Impersonate a Supabase user using SQL
BEGIN;
SET LOCAL request.jwt.claim.sub = '<uid>';
SET LOCAL ROLE authenticated;
SELECT * FROM photos LIMIT 10;
COMMIT;
@cgimenes
cgimenes / terminate_celery.py
Last active December 12, 2024 22:47
Terminate all tasks in Celery
from config.celery import celery_app
celery_app.control.purge()
inspect = celery_app.control.inspect()
scheduled_tasks = inspect.scheduled()
if scheduled_tasks:
for worker, tasks in scheduled_tasks.items():
for task in tasks:
@cgimenes
cgimenes / export_arc_bookmarks.py
Created September 3, 2024 22:36
Script to export Arc Browser bookmarks
import json
file_path = '/Users/<username>/Library/Application Support/Arc/StorableSidebar.json'
lists = {}
tabs = []
with open(file_path, 'r') as f:
parsed_json = json.load(f)
items = parsed_json['sidebar']['containers'][1]['items']
@cgimenes
cgimenes / harpoon_tabline.lua
Created February 19, 2024 19:09
Harpoon files in tabline through Lualine with colored text and switch on click
local colors = require("kanagawa.colors").setup()
local theme_colors = colors.theme
vim.api.nvim_set_hl(0, 'HarpoonActive', { ctermbg = 0, fg = theme_colors.syn.identifier, bg = theme_colors.ui.bg })
vim.api.nvim_set_hl(0, 'HarpoonNumberActive', { ctermbg = 0, fg = theme_colors.syn.number, bg = theme_colors.ui.bg })
vim.api.nvim_set_hl(0, 'HarpoonInactive', { ctermbg = 0, fg = theme_colors.syn.fg, bg = theme_colors.ui.bg_p1 })
vim.api.nvim_set_hl(0, 'HarpoonNumberInactive', { ctermbg = 0, fg = theme_colors.syn.number, bg = theme_colors.ui.bg_p1 })
local function harpoon_files()
local harpoon = require("harpoon")
@cgimenes
cgimenes / enum.md
Created August 25, 2021 10:27
Better enum solution for Rails

Migration Generation

rails g migration add_status_to_catalogs status:catalog_status

Migration

class AddStatusToCatalogs < ActiveRecord::Migration[5.1]
  def up
 execute &lt;&lt;-SQL
@cgimenes
cgimenes / dronePad.js
Last active June 28, 2025 15:17
Mainstage Scripter's Drone Pad Script
var PluginParameters = [
{
name: "Key",
type: "menu",
valueStrings: ["A", "Bb", "B", "C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab"],
minValue: 0,
maxValue: 11,
defaultValue: 0,
numberOfSteps: 11
}, {
@cgimenes
cgimenes / all.txt
Created January 8, 2020 12:32 — forked from jhaddix/all.txt
all wordlists from every dns enumeration tool... ever. Please excuse the lewd entries =/
This file has been truncated, but you can view the full file.
.
..
........
@
*
*.*
*.*.*
🐎