Skip to content

Instantly share code, notes, and snippets.

@paulogdm
paulogdm / gist:e15c84534f713e0d66e76ceb296f2268
Created September 26, 2017 15:58 — forked from nilo/gist:c2a31a0f9f29c88145ca
Using cedilha - ArchLinux Cinnamon
Author: Nilo Dantas - n1lo
Based on: https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/518056 - helio-valente post
How to use Cedilha on US Keyboard on ArchLinux
1) Put: English(US, internacional with dead Keys) on your system keyboard layout.
2) Editing the files:
sudo vim /usr/lib/gtk-3.0/3.0.0/immodules.cache
04d5e324d86e49a5d055f7e9e0b89378688fb4851ec52853b9c1d1c6b763b55515feeb09f1efd11c58c97fc3483207a591a0dc5d9e31e5866c929425a7cbbfe16e
@paulogdm
paulogdm / s3-get.js
Last active July 29, 2018 02:59
[micro-s3-example] Get Signed URL
const getS3 = async (req, res) => {
const s3key = `${req.url.substr(1)}` // we need to remove the first backslash from the url
const params = {
Bucket: config.bucket_name,
Key: s3key,
Expires: 60 * 60 * 24 // 1 day
}
try {
const generateUUID = (size = 10) => {
return randomBytes(Math.ceil(size * 3 / 4))
.toString('base64')
.slice(0, size)
.replace(/\+/g, 'a')
.replace(/\//g, 'b')
}
const postS3 = async (req, res) => {
const {contentType} = await json(req) // we are requiring the ContenType from the request
const router = async (req, res) => {
if (req.method === 'POST') {
return postS3(req, res)
} else if (req.method === 'GET') {
return getS3(req, res)
} else {
throw createError(405, 'Invalid method')
}
}
// taken from https://spectrum.chat/thread/3d15e59b-a893-494a-b8a8-a8cc391094d6
const {send} = require('micro')
const axios = require('axios')
const fs = require('fs')
const sharp = require('sharp')
const memoize = require('memoizee')
{
"version": 2,
"name": "nextjs",
"builds": [{
"src": "package.json",
"use": "@now/static-build",
"config": { "newPipeline": true }
}]
}
{
"version": 2,
"alias": ["shortcutly.com"],
"routes": [
{
"src": "/(.*)",
"status": 301,
"headers": { "Location": "www.shortcutly.com/$1 " }
}
]
@paulogdm
paulogdm / dig for MX
Created October 17, 2019 17:48
bitauth.com dig
dig bitauth.com MX &&\
dig bitauth.com MX @1.1.1.1 &&\
dig bitatuh.com MX @8.8.8.8 &&\
nslookup -q=MX bitauth.com &&\
echo "end of set"
// a.js
module.exports = async (req, res) => {
await middleware(req, res)
}
// b.js
module.exports middleware( async (req, res) => {
// ...
})