Skip to content

Instantly share code, notes, and snippets.

View Zonalds's full-sized avatar
🎯
Focusing

Paschal Zonalds

🎯
Focusing
  • Jiangsu PRC
View GitHub Profile
@Zonalds
Zonalds / gist:6215156b2506bebecfcce5d53fd358cd
Created April 14, 2020 02:00 — forked from Darkflib/gist:8c40e9e0bb60883bd70fb34972b5954a
minio gateway to s3 compatible wasabi with cache + s3fs and ecryptfs
mkdir /mnt/wasabi-cache
lvcreate -L 100G -n wasabi-cache vg0
mkfs.ext4 /dev/vg0/wasabi-cache
docker run -d -p 9000:9000 --name minio-wasabi -e "MINIO_CACHE_DRIVES=/mnt/wasabi-cache" -e "MINIO_CACHE_EXPIRY=40" \
-e "MINIO_ACCESS_KEY=AKKEYKEYKEYKEYKEY" -e "MINIO_SECRET_KEY=mysecret123123123123123" \
minio/minio gateway s3 https://s3.wasabisys.com:443
@Zonalds
Zonalds / node_nginx_ssl.md
Last active November 25, 2023 05:36 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@Zonalds
Zonalds / gist:71336f42090ab003addff32b4b42456c
Last active January 3, 2021 14:08
How to handle return with promise. This is mostly how I build modules with JS
async function Main(data){
return new Promise((resolve, reject) => {
const bearme = []
setTimeout(() => {
data.forEach(entry => {
bearme.push(entry + 'rt')
resolve(bearme)
})
@Zonalds
Zonalds / react-draft-wysiwyg.js
Created March 23, 2021 16:27
Use react-draft-wysiwyg on NextJS. Then convert the draft to html if you so please
import dynamic from 'next/dynamic'
import { convertToRaw } from 'draft-js';
import { useState } from 'react';
import draftToHtml from 'draftjs-to-html';
import '../../../node_modules/react-draft-wysiwyg/dist/react-draft-wysiwyg.css'
const Editor = dynamic(
() => {
return import('react-draft-wysiwyg').then((mod) => mod.Editor);
},
@Zonalds
Zonalds / gist:189cea0af516095bacd2fd66efea6ec8
Created March 24, 2021 12:44
An custom avatar generator API for developer.
function GetRequestResourceIds(data){
console.log(data[0].tagList)
TagList.find({_id: data[0].tagList}, (err, result) => {
console.log(result)
return new Promise(async(resolve, reject) => {
if(!err && result){
// Now create mxLead for each person in this Tag List
// find the greeting info to use
const allRecipients = result[0].jsonList
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@Zonalds
Zonalds / temporary-email-address-domains
Created April 15, 2021 03:39 — forked from adamloving/temporary-email-address-domains
A list of domains for disposable and temporary email addresses. Useful for filtering your email list to increase open rates (sending email to these domains likely will not be opened).
0-mail.com
0815.ru
0clickemail.com
0wnd.net
0wnd.org
10minutemail.com
20minutemail.com
2prong.com
30minutemail.com
3d-painting.com
@Zonalds
Zonalds / stripe-credit-card-numbers.md
Created January 11, 2022 04:07 — forked from rymawby/stripe-credit-card-numbers.md
Stripe test credit card numbers for use in development

#Test credit card numbers to use when developing with Stripe

4242424242424242 Visa

4012888888881881 Visa

4000056655665556 Visa (debit)

@Zonalds
Zonalds / flowSampleData.js
Last active October 11, 2022 11:20
This is just the sample data of the campaign flow
// We can just store the flow as a JSON. That is an array on mongoose.
const sampleFlow = [
{
type: "trigger", //This is what triggers entry to the flow
eventId: "random_auto_generated",
eventName: "Change in customer attribute", //Other option might include customer submited a form, Performed an action
//Other data
},
{
@Zonalds
Zonalds / generate_L_size_csv.py
Created October 24, 2022 18:46 — forked from momota/generate_L_size_csv.py
Generate a large size of CSV file was filled random values. This script generates around 250MB size of the file. You can adjust two parameters `row` and `col` to generate the file which has desirable size.
import csv
import random
def generate_random_array(row, col):
a = []
for i in range(col):
l = [i]
for j in range(row):
l.append(random.random())
a.append(l)