Skip to content

Instantly share code, notes, and snippets.

View brunoluiz's full-sized avatar
🤌

Bruno Luiz Silva brunoluiz

🤌
View GitHub Profile
@brunoluiz
brunoluiz / index.js
Created January 5, 2022 10:54
amex-check-statement-values
let paymentReceivedRowId = 0;
document.querySelectorAll('div.col-md-5.col-sm-8.pad-responsive-lr.pad-1-t-sm-down').forEach((n, idx) =>
n.textContent.includes('PAYMENT RECEIVED') ? paymentReceivedRowId = idx : null
);
// navigate to the statement view
let items = [];
document.querySelectorAll('div.col-md-3.col-sm-4.pad-responsive-r.flex.flex-column-md.flex-justify-end').forEach((n, idx) => {
if (idx === paymentReceivedRowId) return;
items.push(n.textContent.replaceAll('£',''));
@brunoluiz
brunoluiz / README.md
Last active September 28, 2021 08:15
kustomize-migrate-bases-to-resources

Converts kustomize bases entries to resources

As bases is deprecated since version 2.10, I've created this script to automate the migration. Bear in mind that it might need some spot checks, as it seems it deletes YAML comments and, if you are using YAML comments, you might need to do it manually.

Running

  • npm install
@brunoluiz
brunoluiz / main.go
Last active July 28, 2022 04:37
rrweb-server-ui-hack
package main
// ☢️ WARNING: If you are alergic to messy cowboy codes, please don't read the code below ☢️
//
// # Intro:
//
// This snippet of magic is to test rrweb as a possible replacement to FullStory. It uses badger as storage because I
// didn't want to deal with setting up a container and migrations for storage.
// > FullStory is a tool to record user sessions for further analysis (can be for debugging, UX etc)
//
@brunoluiz
brunoluiz / main.go
Created November 10, 2020 15:19
HTTP logger server
package main
import (
"fmt"
"net/http"
"net/http/httputil"
)
func main() {
mux := http.NewServeMux()
@brunoluiz
brunoluiz / grpc-example.proto
Last active November 13, 2019 20:23
gists-for-protos-post
syntax = "proto3";
service SnapshotService {
rpc CreateSnapshot (CreateSnapshotRequest) returns (CreateSnapshotResponse);
}
message CreateSnapshotRequest {
string url = 1;
}
const matcher = /^(CONFIG_|REACT_APP).*$/g;
const replacer = /(CONFIG_|REACT_APP)/g;
const pconfigs = Object.keys(process.env).reduce((acc, key) => {
if (!key.match(matcher)) {
return acc;
}
const k = key.replace(replacer, '');
return { ...acc, [k]: process.env[key] };
@brunoluiz
brunoluiz / addPullRequestReview.graphql
Last active July 23, 2019 19:05
Github API tricks
mutation {
addPullRequestReview(input: {
clientMutationId:"client-test?",
pullRequestId:"MDExOlB1bGxSZXF1ZXN0MjU0MTc2Mzcy",
comments: [{
path: "content/blog/2019/feb/prettier/index.md",
body:"test",
position: 89
}]
event:COMMENT
@brunoluiz
brunoluiz / Makefile
Created August 15, 2018 22:43
golang makefile
.PHONY: up
up:
docker-compose -f ./deployment/$(app)/dev.docker-compose.yml --project-directory . up -d
.PHONY: build
build: stop
docker-compose -f ./deployment/$(app)/dev.docker-compose.yml --project-directory . build
.PHONY: stop
stop:
@brunoluiz
brunoluiz / diffs.md
Last active August 7, 2018 22:51
diffs.md

Old format:

{
    "clientId": "hering",
    "origin": {
      "type": "CLIENT",
      "name": "Cia Hering",
      "account": "voucher"
    },
#!/bin/bash
CURL="/usr/bin/curl"
export LC_ALL=en_US.UTF-8
# Configs
URL="$1"
REQUESTS=$(cat $2)
OUTPUT_PATH="./out"
OUTPUT="$OUTPUT_PATH/results-$(date +%s).csv"