Skip to content

Instantly share code, notes, and snippets.

View leblancmeneses's full-sized avatar
🏠
Working from home

Leblanc Meneses leblancmeneses

🏠
Working from home
View GitHub Profile
@davidfowl
davidfowl / cleanrg.cs
Created June 16, 2025 21:42
A C# tool for cleaning up resource groups
// -----------------------------------------------------------------------------
// Azure RG Janitor - Spectre Edition
// Run with: dotnet run cleanup-rg.cs
// Targets: .NET 10 Preview 4+
// -----------------------------------------------------------------------------
#:package Azure.Identity@1.*
#:package Azure.ResourceManager@1.*
#:package Spectre.Console@0.50.0
@heddendorp
heddendorp / trpc-client.ts
Last active October 30, 2024 17:34
Example link that uses angular httpClient to run trpc calls
import { inject, InjectionToken } from '@angular/core';
import type { AppRouter } from '@evorto/server/appRouter';
import { HttpClient } from '@angular/common/http';
import { CreateTRPCClient, createTRPCClient, TRPCLink } from '@trpc/client';
import type { AnyRouter } from '@trpc/server';
import { observable } from '@trpc/server/observable';
import superjson, { SuperJSONResult } from 'superjson';
const TRPC_CLIENT = new InjectionToken<CreateTRPCClient<AppRouter>>(
'TRPC_CLIENT',
@dinvlad
dinvlad / retries.ts
Last active February 2, 2024 16:18
Retries with exponential backoff and jitter for idempotent background Google Cloud Functions
// one can also use Google Cloud Firestore library,
// with a slight change in semantics
import { firestore } from 'firebase-admin';
import { EventContext, runWith } from 'firebase-functions';
import { promisify } from 'util';
const eventCollection = 'function-events';
enum EventStatus {
RUNNING = 'running',
@mbleigh
mbleigh / README.md
Last active June 25, 2025 18:44
Firebase Hosting Fetch All Files

Fetch All Files from Firebase Hosting

This script fetches all of the files from the currently deployed version of a Firebase Hosting site. You must be signed in via the Firebase CLI and have "Site Viewer" permission on the site in question to be able to properly run the script.

Running via NPX

npx https://gist.github.com/mbleigh/9c8680cf319ace2f506f57380da66e7d <site_name>
@dnozay
dnozay / My Exiftool Cheatsheet.md
Last active May 17, 2025 20:25 — forked from rjames86/My Exiftool Cheatsheet.md
Cheatsheet for image / video metadata manipulation.

Cheatsheet for image / video metadata manipulation.

Last updated 2019-07-24

Disclaimer

until more specific license...

THE CONTENT BELOW IS PROVIDED "AS-IS",
WE DISCLAIM LIABILITY FOR ALL USES TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW.
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active November 12, 2025 11:45
set -e, -u, -o, -x pipefail explanation

A handful of BigQuery SQL queries that you can use to analyze your own Google Analytics for Firebase data. To find out more about how they work, check out our presentation from Cloud Next 2018 (Video link to be added soon)

Please note that these scripts have been updated to make sure of the new Firebase schema, which was rolled out to Analytics products in July of 2018.

Note that none of these scripts will work out of the box -- you'll need to update the values in brackets with the names of your actual datasets, and you'll most likely also need to replace the names of events and event properties with ones that are appropriate for your app.

The contents of this gist are licensed under the Apache License, version 2.0

export const countReviews = functions.firestore.document("movies/{movieId}/reviews/{reviewId}").onCreate(async (event) => {
console.log(`Got a ${event.data.data().stars} star review`);
const review = event.data.data();
admin.database().ref("movieRevies").child(event.params.movieId).transaction(movie => {
if (!movie) {
return movie;
}
@katowulf
katowulf / rules.js
Created March 3, 2016 00:05
Search for users by email address in Firebase, without exposing everyone's email address to the world in a bulk-readable format.
{
"rules": {
"users": {
"$user_id": {
// email address is required
".validate": "newData.hasChildren(['email'])",
}
},
"emails_to_users": {
@elcamino
elcamino / full-page-screenshots-selenium-chrome.rb
Last active February 1, 2024 21:41
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);")