Skip to content

Instantly share code, notes, and snippets.

View franciscocpg's full-sized avatar

Francisco Guimarães (chico) franciscocpg

View GitHub Profile
@franciscocpg
franciscocpg / install.sh
Last active May 12, 2018 20:11 — forked from koshigoe/mount-ram.sh
Like tmpfs in Mac OSX
#!/bin/bash
set -e
curl https://gist.githubusercontent.com/franciscocpg/e929676f28c321692237/raw/mount-ram.sh -o /usr/local/bin/mount-ram
chmod +x /usr/local/bin/mount-ram
curl https://gist.githubusercontent.com/franciscocpg/e929676f28c321692237/raw/umount-ram.sh -o /usr/local/bin/umount-ram
chmod +x /usr/local/bin/umount-ram
@franciscocpg
franciscocpg / readme.md
Created October 7, 2016 16:59 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

@franciscocpg
franciscocpg / proxy.go
Created November 11, 2016 17:39 — forked from vmihailenco/proxy.go
Simple TCP proxy in Golang
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
@franciscocpg
franciscocpg / auto-deploy.md
Last active November 28, 2016 17:54 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

@franciscocpg
franciscocpg / limitConcurrentGoroutines.go
Created February 23, 2017 03:44 — forked from AntoineAugusti/limitConcurrentGoroutines.go
Limit the maximum number of goroutines running at the same time
package main
import (
"flag"
"fmt"
"time"
)
// Fake a long and difficult work.
func DoWork() {
@franciscocpg
franciscocpg / google-form-to-github-issue.md
Created April 12, 2017 16:27 — forked from bmcbride/google-form-to-github-issue.md
Create a new GitHub Issue from a Google Form submission

Wiring up a Google Form to GitHub is not that difficult with a little bit of Apps Script automation. All you need is a Google account, a GitHub account, and a web browser...

Set up your GitHub Personal Access Token

Personal access tokens provide an easy way to interact with the GitHub API without having to mess with OAuth. If you don't already have a personal access token with repo or public_repo access, visit your GitHub settings page and generate a new token.

Be sure to copy your token some place safe and keep it secure. Once generated, you will not be able to view or copy the token again.

Set up the Form & Spreadsheet

  1. Create a Google Form.
@franciscocpg
franciscocpg / remount.sh
Created September 1, 2017 01:21 — forked from ertseyhan/remount.sh
Temporarily increase size of tmp folder on Arch linux
#!/bin/bash
sudo mount -o remount,size=10G,noatime /tmp
echo "Done. Please use 'df -h' to make sure folder size is increased."
@franciscocpg
franciscocpg / sleep.js
Created May 29, 2018 19:54 — forked from yentsun/sleep.js
ES6 Sleep
const sleep = require('util').promisify(setTimeout);
//...
await sleep(15);
//...
@franciscocpg
franciscocpg / jwt-expiration.md
Created May 21, 2019 20:58 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC: