Skip to content

Instantly share code, notes, and snippets.

Avatar

João Antonio Ferreira joao-parana

View GitHub Profile
@HoverBaum
HoverBaum / create-blogposts.js
Created Mar 22, 2018
Creating blogposts in Contentful.
View create-blogposts.js
const createBlogPosts = async (posts, assets, categories, managementToken, spaceId, simpleLog = console.log) => {
const client = contentful.createClient({
accessToken: managementToken,
logHandler: (level, data) => simpleLog(`${level} | ${data}`)
})
const space = await client.getSpace(spaceId)
const linkMap = new Map()
assets.forEach(asset => linkMap.set(asset.wpAsset.link, asset.fields.file['en-US'].url))
@joao-parana
joao-parana / hello.html
Last active Dec 18, 2017
SOMA 01 - Hello World
View hello.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="SOMA 01 - Hello World">
<title>SOMA 01 - Hello World</title>
</head>
<body>
<script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script>
<script>
@andrearota
andrearota / example.scala
Created Oct 18, 2016
Creating Spark UDF with extra parameters via currying
View example.scala
// Problem: creating a Spark UDF that take extra parameter at invocation time.
// Solution: using currying
// http://stackoverflow.com/questions/35546576/how-can-i-pass-extra-parameters-to-udfs-in-sparksql
// We want to create hideTabooValues, a Spark UDF that set to -1 fields that contains any of given taboo values.
// E.g. forbiddenValues = [1, 2, 3]
// dataframe = [1, 2, 3, 4, 5, 6]
// dataframe.select(hideTabooValues(forbiddenValues)) :> [-1, -1, -1, 4, 5, 6]
//
// Implementing this in Spark, we find two major issues:
@voxxit
voxxit / USING-VAULT.md
Last active Sep 27, 2020
Consul + Vault + MySQL = <3
View USING-VAULT.md
git clone https://gist.github.com/dd6f95398c1bdc9f1038.git vault
cd vault
docker-compose up -d
export VAULT_ADDR=http://192.168.99.100:8200

Initializing a vault:

vault init