Skip to content

Instantly share code, notes, and snippets.

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

Jean Carlo Nascimento suissa

🏠
Working from home
  • Suissa Corp
  • Brasil
View GitHub Profile
@suissa
suissa / uptime.erl
Created April 8, 2022 01:51 — forked from seriyps/uptime.erl
Uptime of Erlang node
-export([uptime/0, uptime/1, uptime_string/0]).
%% @doc uptime in native time units
uptime() ->
erlang:monotonic_time() - erlang:system_info(start_time).
%% @doc uptime in specified time units
uptime(Unit) ->
erlang:convert_time_unit(uptime(), native, Unit).
// Discord all events!
// A quick and dirty fleshing out of the discord.js event listeners (not tested at all!)
// listed here -> https://discord.js.org/#/docs/main/stable/class/Client
// Learn from this, do not just copy it mofo!
//
// Saved to -> https://gist.github.com/koad/316b265a91d933fd1b62dddfcc3ff584
/*
koad-was-here
@suissa
suissa / free-photoshop.md
Created May 13, 2019 20:11 — forked from molcik/free-photoshop.md
Modify Photoshop to never ending trial

How Does It Work

All you have to do, to extend your trial period, is change number in TrialKey element in application.xml. This file is located in /Library/Application Support/Adobe/Adobe Photoshop/AMT. You can navigate there with this command:

cd /Library/Application\ Support/Adobe/Adobe\ Photoshop\ */AMT

Then you have to open the file and edit it. You can use just TextEdit app.

open -a TextEdit application.xml
@suissa
suissa / git-clearHistory
Created May 6, 2019 22:44 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@suissa
suissa / mysql-docker.sh
Created March 10, 2019 12:44 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@suissa
suissa / ultimate-ut-cheat-sheet.md
Created August 21, 2018 21:22 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


@suissa
suissa / my-factory.js
Last active August 9, 2018 11:42 — forked from hc3/my-factory.js
import nodemailer from 'nodemailer';
const transporter = nodemailer.createTransport({
host: 'smtp.gmail.com',
port: 465,
secure: true, // use SSL
auth: {
user: "mailer@gmail.com",
pass: "senha"
}
@suissa
suissa / download.js
Created June 14, 2018 16:59 — forked from fabiobusnello/download.js
downloads using fetch
export const download = async (params = {}) => {
const caching = await fetch(params.url, params)
const fileName = caching.headers.get('Content-Disposition')
const ext = fileName.split('.')[fileName.split('.').length - 1].replace('"', '')
const blob = await caching.blob()
const url = await URL.createObjectURL(blob)
const a = document.createElement("a");
a.href = url
a.download = `Reports.${ext}`
a.click()
@suissa
suissa / api.js
Last active March 29, 2018 16:22
router
'use strict'
const methods = require('./methods')
/** */
const getMethod = (req) => req.method.toLowerCase()
const end = (res, method) => {
console.log('request incorrect: ', method)
res.end()
}
@suissa
suissa / React.js
Last active March 9, 2018 02:36 — forked from rafaelaugustos/React.js
// Login
async Api(){
this.setState({loading: true})
NetInfo.isConnected.addEventListener(
'connectionChange',
(isConnected) => this.setState({internet: isConnected})
)