Skip to content

Instantly share code, notes, and snippets.

View mxcoder's full-sized avatar

ricardoe mxcoder

  • DUS
View GitHub Profile
@ML-engineer
ML-engineer / duckdb_bq_storage_api.py
Created July 4, 2022 22:08
Read BQ table to DuckDB directly from storage read api
import duckdb
from google.cloud import bigquery
bqclient = bigquery.Client()
table = bigquery.TableReference.from_string(
"bigquery-public-data.utility_us.country_code_iso"
)
rows = bqclient.list_rows(table)
country_code_iso = rows.to_arrow(create_bqstorage_client=True)
cursor = duckdb.connect()
@henridf
henridf / protoc-encode.md
Last active January 20, 2024 14:16
Encoding a protobuf with `protoc --encode`

I needed to quickly encode a protobuf from the command-line, and while I pretty much immediately came across protoc --encode as the obvious solution, I did not find much documentation on the input textual syntax.

Here is the relevant snippet from protoc --help:

--encode=MESSAGE_TYPE       Read a text-format message of the given type
                              from standard input and write it in binary
                              to standard output.  The message type must
                              be defined in PROTO_FILES or their imports.
@ebidel
ebidel / coverage.js
Last active April 27, 2024 04:13
CSS/JS code coverage during lifecycle of page load
Moved to https://github.com/ebidel/puppeteer-examples
@shospodarets
shospodarets / Chrome headless Puppeteer- capture DOM element screenshot using
Last active January 17, 2023 18:52
Chrome headless Puppeteer- capture DOM element screenshot using
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Adjustments particular to this page to ensure we hit desktop breakpoint.
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1});
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'});
@jeshan
jeshan / get-lambda-event-source.js
Last active June 23, 2023 13:01
AWS Lambda: Determine Event Source from event object. Note that this is an approximation as anybody can send a payload that resembles the real thing.
function getLambdaEventSource(event) {
if (event.Records && event.Records[0].cf) return 'isCloudfront';
if (event.configRuleId && event.configRuleName && event.configRuleArn) return 'isAwsConfig';
if (event.Records && (event.Records[0].eventSource === 'aws:codecommit')) return 'isCodeCommit';
if (event.authorizationToken === "incoming-client-token") return 'isApiGatewayAuthorizer';
if (event.StackId && event.RequestType && event.ResourceType) return 'isCloudFormation';
@leonardofed
leonardofed / README.md
Last active April 29, 2024 10:49
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

  • Voltea a verme, primero fijate, ¿OK?
  • En la siguiente vez que te vea me lo repites en la jeta, no aquí, a ver si te sale tan fluido...
  • Si, pendejo.
  • ¿Y los goles?
  • ¿Cuáles goles?
  • Los del América.
  • ¿Y tú quién eres para preguntar por los goles?
  • El hijo de la chingada que te va a romper la madre.
  • Dispárale si tienes huevos.
  • PAM PAM.
@magnetikonline
magnetikonline / README.md
Last active March 16, 2024 02:00
Bash string manipulation cheatsheet.

Bash string manipulation cheatsheet

Assignment
Assign value to variable if variable is not already set, value is returned.

Combine with a : no-op to discard/ignore return value.
${variable="value"}
: ${variable="value"}
@wandernauta
wandernauta / sp
Last active April 16, 2024 15:37
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#