Skip to content

Instantly share code, notes, and snippets.

View helton's full-sized avatar
🏠
Working from home

Helton Carlos de Souza helton

🏠
Working from home
View GitHub Profile
@helton
helton / webpack.config.js
Created June 20, 2022 03:54
Module Federation with Angular without ESM modules
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
const mf = require("@angular-architects/module-federation/webpack");
const path = require("path");
const share = mf.share;
const sharedMappings = new mf.SharedMappings();
sharedMappings.register(
path.join(__dirname, 'tsconfig.json')
);
@helton
helton / README.md
Last active June 27, 2021 20:56
AWS API Gateway - Examples

API Gateway - Examples

curl "https://ocywyw3jq5.execute-api.us-east-1.amazonaws.com/dev/api/just-passthrough" -H "Authorization: Basic <base64encodeduserpassword>"
  • Using passthrough (manipulating response payload):
@helton
helton / jwt.js
Created May 3, 2021 21:29
JWT with HS256 (HMAC SHA-256) algorithm in JS
function base64UrlEncode(str) {
return btoa(str).replace('+', '-').replace('/', '_').replace(/=+$/, '');
}
async function HMACSHA256(key, message){
const g = str => new Uint8Array([...unescape(encodeURIComponent(str))].map(c => c.charCodeAt(0))),
k = g(key),
m = g(message),
c = await crypto.subtle.importKey('raw', k, { name: 'HMAC', hash: 'SHA-256' },true, ['sign']),
s = await crypto.subtle.sign('HMAC', c, m);
@helton
helton / Kubernetes.md
Created February 10, 2020 01:08
Kubernetes - Notes and Commands

Kubernetes

  • It's a container orchestration
    • Many servers act like one
  • Released in 2015
  • Runs on top of Docker
  • Provides CLI/API to manage container across servers
    • kubectl
  • Services
  • Clouds: Google Engine, etc
@helton
helton / list-all-jenkins-plugins.groovy
Created February 8, 2020 23:36
List all Jenkins plugins sorted by name - Open http://JENKINS_HOST:PORT/script and run this script
new ArrayList(Jenkins.instance.pluginManager.plugins)
.sort { it.getShortName() }
.each {
plugin ->
println ("${plugin.getShortName()}:${plugin.getVersion()}")
}
@helton
helton / _credits.md
Last active February 10, 2022 14:33
Charadas
@helton
helton / quizlet-simple-markdown.js
Created May 6, 2018 22:06
Simple Markdown for Quizlet description (info page)
const markdown = raw => {
const createBulletList = content => {
const regex = /- /gi
return content.match(regex).reduce((body, bullet) => body.replace(bullet, `<pre style="display: inline-block">• </pre>`), content)
}
const createLinks = content => {
const regex = /\[(.*?)\]\((https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)(\?hl=[a-z]{2})?)\)/gi
let result = content
let match = regex.exec(content)
while (match !== null) {
@helton
helton / remove-medium-login-popup.js
Last active May 2, 2018 16:43
Remove forced login popups (Quora, Medium, LinkedIn)
(function() {
const dialogNode = document.querySelector('.overlay.overlay--lighter')
if (dialogNode) {
document.body.style.overflow = 'auto'
dialogNode.remove()
}
})()
@helton
helton / db.json
Created December 11, 2017 12:30
Fetch API Test - POST (make sure you start json-server => https://github.com/typicode/json-server)
{
"posts": [
{ "id": 1, "title": "json-server", "author": "typicode" }
],
"comments": [
{ "id": 1, "body": "some comment", "postId": 1 }
],
"profile": { "name": "typicode" }
}
@helton
helton / styles.less
Last active May 15, 2018 05:53
Atom Configuration for JavaScript (JSX) with Fira Code as Font Ligature
//Custom configuration
atom-text-editor {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
font-family: "Operator Mono";
font-size: 16px;
font-weight: 500;
line-height: 1.5;
}