Skip to content

Instantly share code, notes, and snippets.

View crimeminister's full-sized avatar
💭
🔥 🐶🎩☕️🔥

Robert Medeiros crimeminister

💭
🔥 🐶🎩☕️🔥
View GitHub Profile
@crimeminister
crimeminister / config.json
Last active November 30, 2023 05:41
Fetch and pin Pokemon data via IPFS (using estuary.tech)
{
"Pinning": {
"RemoteServices": {
"pinata": {
"API": {
"Endpoint": "https://api.pinata.cloud/psa",
"Key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiJlNGY4ZTI0NS04ZDU2LTQ2NjktYTliNC05MjIwOGQzYzc3MWEiLCJlbWFpbCI6InJvYmVydEBjcmltZW1pbmlzdGVyLm9yZyIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJwaW5fcG9saWN5Ijp7InJlZ2lvbnMiOlt7ImlkIjoiTllDMSIsImRlc2lyZWRSZXBsaWNhdGlvbkNvdW50IjoxfV0sInZlcnNpb24iOjF9LCJtZmFfZW5hYmxlZCI6ZmFsc2V9LCJhdXRoZW50aWNhdGlvblR5cGUiOiJzY29wZWRLZXkiLCJzY29wZWRLZXlLZXkiOiI5NDc5ODU1YWYxYTAwMjJjNGMwMyIsInNjb3BlZEtleVNlY3JldCI6Ijk5MTIxN2Y1MjEyZWM1YjgzNmI2MmI0YjhiMWQ0ZjJhMTI2NTk5ZWQwMTM2NTdiZjNkMzZlNjQ2MTA4OWE2MDMiLCJpYXQiOjE2MzExMzIzODh9.BLNp06PT7kt7V6uBfc4gi_1cK4aJ4LRnnvduYHrpfHo"
},
"Policies": {
"MFS": {
@crimeminister
crimeminister / gist:8585747d63dd370cfbe7d8048b685a57
Created February 7, 2023 15:47
Return the paths on your Java classpath from the Clojure REPL
(clojure.string/split (java.lang.System/getProperty "java.class.path") #":")
"use strict";
// ADAPTED FROM: botbuilder-adapter-slack/lib/messagetype_middleware.js
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
@crimeminister
crimeminister / gist:da9930518d95032098b06fe3213f8896
Created September 24, 2019 17:31
Extract encrypted credential from Terraform state file
#!/usr/bin/env bash
#
# -*- mode: shell-script -*-
set -eo pipefail
# Take as input a file containing the "private_key_encrypted" value of a
# service account key, extracted from a Terraform state file. To put the
# key there in the first place use Terraform something like this:
#
@crimeminister
crimeminister / requirements.txt
Created September 11, 2019 14:27
Stock scraper for Yahoo! Finance
bs4
requests
@crimeminister
crimeminister / chain.clj
Created May 4, 2017 22:21
Pedestal "prequeue" utility method for prepending interceptors to the interceptor chain
;; This is a snippet of code I used to prepend interceptors to the Pedestal interceptor chain.
;; It was written because of a situation in which I had to be sure that the added interceptors
;; executed immediately after the current interceptor. Would there be any interest in a PR to
;; add this to Pedestal, possible with a different API? E.g. instead of (prequeue) I could alter
;; the (chain/enqueue) function to accept a :location argument:
;;
;; (enqueue :location :front)
;; (enqueue :location :back)
;; (enqueue :location :after some-other-interceptor)
@crimeminister
crimeminister / from-cli.clj
Created May 2, 2017 19:14
Load config using cprop and merge with configuration taken from CLI
;; This is the snippet of code I use to merge CLI options with config loaded using cprop.
;; Do you have any interest in a PR that adds a (from-cli) function to cprop.sources, or
;; is that a non-goal?
;; To override the default values stored in the config.edn
;; configuration file using environment variables, note that double
;; underscore ("__") is used to represent nesting, e.g. FOO__BAR is
;; merged into the combined config map as {:foo {:bar …}}. To override
;; configuration values from the command line double hyphen ("--") is
;; used to representing nesting instead, e.g. --foo--bar is merged
@crimeminister
crimeminister / emacs-xml-test.el
Created September 29, 2016 02:57
A simple example of XML processing in Emacs-Lisp
(let* ((xml "<post time=\"20050716234509\" id=\"010101\">
<login>Test</login>
<msg>Here is the message</msg>
<info>My UA</info>
</post>")
(root (with-temp-buffer
(insert xml)
(xml-parse-region (point-min) (point-max))))
(post (car root))
(login (car (xml-get-children post 'login)))