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 / 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 February 1, 2022 20:05
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.
.
..
........
@
*
*.*
*.*.*
🐎
@cgimenes
cgimenes / pocket_importer.rb
Created June 1, 2019 16:51
Import to Pocket from a file (CSV or lines)
require 'httparty'
require 'socket'
require 'cgi'
require 'csv'
require 'json'
require 'thor'
class PocketAPI
def initialize(consumer_key)
@consumer_key = consumer_key
@cgimenes
cgimenes / for.sh
Last active August 2, 2019 17:49
Bash's for block examples
for ip in $(cat ips); do
nc -z -w 1 -v $ip 80
done
for file in $(find . -name .git -type d -prune); do
cd $file
cd ..
gmg @sec register $(pwd)
cd ~/security
done
@cgimenes
cgimenes / cli.py
Last active May 7, 2019 14:47
Simple python CLI script for example
import requests
import sys
import urllib3
import argparse
from collections import OrderedDict
def main(args):
ranges = OrderedDict()
for item in args.many: