This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const FormData = require('form-data') | |
const axios = require('axios') | |
const fs = require('fs') | |
const path = require('path') | |
async function upload(image_url_or_base64, file_name, overwrite) { | |
const data = { | |
file: image_url_or_base64, | |
fileName: file_name, | |
useUniqueFileName: !overwrite, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove white background (and make it transparent) | |
magick *.png -bordercolor white -fuzz 20% -trim -transparent #ffffff output_%02d.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios') | |
const user = '<your username>' | |
const repo = '<your repo>' | |
const personal_access_token = '<your token>' // with repo_deployment access | |
const url = `https://api.github.com/repos/${user}/${repo}/deployments` | |
const auth = { | |
username: user, | |
password: personal_access_token, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Symmetric difference of two sets is the set of elements | |
which are in either of the two sets but not in both. | |
e.g. | |
symmetric_difference([1, 2, 3], [5, 2, 1, 4]) | |
// [3, 5, 4] | |
*/ | |
function symmetric_difference(...args) { |