Skip to content

Instantly share code, notes, and snippets.

View giulianobr's full-sized avatar

Giuliano Ribeiro giulianobr

View GitHub Profile
@sayle-doit
sayle-doit / bq_per_table_storage_billing_recommendation.sql
Last active March 4, 2024 11:37
BigQuery storage billing model recommender on a per table basis
/*
* This query will look at a single project (by default in US multi-region) and
* calculate the logical and physical billing prices for each table in all datasets
* contained inside of it then provide a recommendation on if it is better to put it
* into a dataset that uses the logical (uncompressed) or physical (compressed)
* storage billing models.
*
* Physical (also called compressed) Storage went GA on July 5, 2023. It is set at
* the dataset level, so if two or more tables are better suited for different
* billing models in the same dataset it may be best to split them into separate
@steren
steren / enable-fb-hosting-cloud-run.sh
Last active March 26, 2022 19:14
Set up Firebase Hosting in front of a Cloud Run service
#!/bin/bash
# Set up Firebase Hosting in front of a Cloud Run service, without using the firebase CLI
# The following commands must be installed:
# - gcloud
# - curl
# - jq
# Update these variables
PROJECT_ID="enable-fb-hosting" # Make sure you have enabled Firebase on this Google Cloud project
@m-radzikowski
m-radzikowski / script-template.sh
Last active April 25, 2024 18:43
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@fmeyer
fmeyer / thing.js
Last active June 3, 2021 12:06
Unfollow everyone on linkedin
// Go to here https://www.linkedin.com/feed/following/?filterType=connection
// open the chrome dev tools console
// paste the following
// go grab a cup of tea
// get rid of all life coach from linkedin
var buttons = $('button'), interval = setInterval(function() {
var btn = $('.is-following');
console.log('Clicking:', btn);
btn.click();
@subfuzion
subfuzion / curl.md
Last active April 27, 2024 20:56
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@Spencer-Easton
Spencer-Easton / exportSpreadsheet.gs
Last active March 21, 2024 00:43
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@jboner
jboner / latency.txt
Last active April 28, 2024 01:46
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@bradmontgomery
bradmontgomery / dummy-web-server.py
Last active April 15, 2024 14:27
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request: