Skip to content

Instantly share code, notes, and snippets.

View rodolfo42's full-sized avatar
🎧

Rodolfo Ferreira rodolfo42

🎧
View GitHub Profile
@rodolfo42
rodolfo42 / load_bq.py
Created June 12, 2024 21:44
Carregando Dataframes no BigQuery
from google.colab import userdata
from google.oauth2 import service_account
from google.cloud import bigquery
import json
import pandas as pd
import pyarrow as pa
# Configura o client do BigQuery
# precisa ter o secret configurado no Colab, chave 'svc_account'
credentials = service_account.Credentials.from_service_account_info(
@rodolfo42
rodolfo42 / okta.csv
Created July 19, 2023 17:19
Import users into Lightdash from Okta CSV dump (Clojure)
user.id user.firstName user.lastName user.email user.status
00u5vogndju36975tn First Last [email protected] ACTIVE
@rodolfo42
rodolfo42 / date_dimension.sql
Created May 24, 2023 15:07
Date dimension table Postgres (with Portuguese locale)
set lc_time to 'pt_BR.utf8';
select TO_CHAR(DATE(NOW()), 'TMDay');
-- Quarta
CREATE TABLE dim_date
(
date_dim_id INT NOT NULL,
date_actual DATE NOT NULL,
epoch BIGINT NOT NULL,
@rodolfo42
rodolfo42 / data.clj
Created May 19, 2023 17:30
Pull datomic data by namespace with tx-time
(ns data
(:require [datomic.client.api :as datomic]))
(def client
(datomic/client {:db-name ""
:system ""
:server-type :cloud
:region ""
:endpoint ""}))
@rodolfo42
rodolfo42 / deps.edn
Last active July 13, 2022 19:30
Generate EQL query from sample data (with Pathom)
{:deps {com.wsscode/pathom3 {:mvn/version "2022.07.08-alpha"}}}
@rodolfo42
rodolfo42 / crux_zoned_date_time.clj
Last active May 20, 2021 22:56
Crux & ZonedDateTime (vs. java.util.Date, LocalDate, LocalDateTime)
(ns crux-zoned-date-time
(:require [crux.api :as crux]
[clojure.pprint :refer [pprint]])
(:import [java.util UUID Date]
[java.time LocalDateTime ZonedDateTime LocalDate Instant]))
(def sample-n 10)
(defonce node
(crux/start-node {}))
@rodolfo42
rodolfo42 / README.md
Last active April 20, 2021 02:00
Completed JSON

For when you have incomplete JSON strings like:

{"Fault":
  {"faultcode": "StartTransmissionFail",
   "faultstring": {"content": "Internal Error"

Given an incomplete JSON-encoded string, attempts to complete it with the missing ", } and ] characters necessary for it to be valid.

@rodolfo42
rodolfo42 / code.js
Last active April 9, 2020 02:42
Bookmarklet to organize status checks in bors
function appendRow(el, test, status, link) {
var testName = document.createElement("div");
var statusCell = document.createElement("div");
statusCell.innerText = status;
var order = (status == "Succeeded" ? 10 : 5);
testName.style = "flex-basis: 50%; flex-grow: 2; padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px dashed #666; order: " + order + ";";
statusCell.style = "flex-grow: 1; text-align: right; padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px dashed #666; order: " + order + ";";
if (link) {
var a = document.createElement("a");
a.innerText = test;
@rodolfo42
rodolfo42 / README.md
Last active February 28, 2023 17:39 — forked from bltavares/README.md
Resources for learning Clojure
@rodolfo42
rodolfo42 / watch.clj
Created August 29, 2018 14:27
watch files for changes and reload namespaces
(require '[io.pedestal.service-tools.dev :as dev-tools])
(def ^:private watcher (atom nil))
(defn stop-watching []
(let [stop @watcher]
(when (fn? stop) (stop) (reset! watcher nil))))
(defn watch
([] (watch ["src/"]))