Skip to content

Instantly share code, notes, and snippets.

View rodolfo42's full-sized avatar
🎧

Rodolfo Ferreira rodolfo42

🎧
View GitHub Profile
@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@example.com 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 / README.md
Last active February 28, 2023 17:39 — forked from bltavares/README.md
Resources for learning Clojure
@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 / batch-write.js
Created August 8, 2017 14:20
DynamoDB streams lambda trigger
const items = [{
"Username": "First",
"Timestamp": "2017-08-07T19:51:00.794Z",
"Message": "first item in batch"
},
{
"Username": "Second",
"Timestamp": "2017-08-07T19:51:00.794Z",
"Message": "second item in batch"
},
@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 / tomcat.sh
Last active May 13, 2020 06:02
Apache Tomcat 7 service init script
#!/bin/bash
### BEGIN INIT INFO
# Provides: tomcat
# Defalt-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Apache Tomcat 7
### END INIT INFO
# base dir of tomcat installation #
CATALINA_HOME=/opt/tomcat/
@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;