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 / tips_increase_memory_limit_nodejs.md
Created April 9, 2024 06:24 — forked from motss/tips_increase_memory_limit_nodejs.md
[TIPS] Increase memory limit in Node.js

By default the memory limit in Node.js is 512MB.

This will cause FATAL ERROR- JS Allocation failed – process out of memory when processing large data files.

It can be avoided by increasing the memory limit.

See Command-line options for more details.

node --max-old-space-size=1024 server.js # increase to 1gb
@Zonalds
Zonalds / tailwind-webpack-setup.md
Created January 30, 2024 06:55 — forked from bradtraversy/tailwind-webpack-setup.md
Setup Webpack with Tailwind CSS

Webpack & Tailwind CSS Setup

Create your package.json

npm init -y

Create your src folder

Create a folder called src and add an empty index.js file. The code that webpack compiles goes in here including any Javascript modules and the main Tailwind file.

@Zonalds
Zonalds / puppeteer-ubuntu-1804.md
Last active January 16, 2024 13:44 — forked from winuxue/puppeteer-ubuntu-1804.md
Solution for common dependences issues using puppeteer in ubuntu 18.04 (Bionic)

puppeteer dependeces in ubuntu 18.04 (Bionic)

error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

sudo apt-get install libnss3

error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

sudo apt-get install libxss1
@Zonalds
Zonalds / transparent-gif.js
Created June 27, 2023 05:40 — forked from sspencer/transparent-gif.js
Serve a transparent GIF from NodeJS
// Two ways to serve transparent GIF
var buf = new Buffer([
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00,
0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x2c,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02,
0x02, 0x44, 0x01, 0x00, 0x3b]);
res.send(buf, { 'Content-Type': 'image/gif' }, 200);
@Zonalds
Zonalds / sendPush.js
Created May 16, 2023 16:36
Shows how to send Push notification using firebase.admin
import admin from "firebase-admin";
// initialize the admin
admin.initializeApp({
credential: admin.credential.cert({
projectId: project_id,
clientEmail: client_email,
privateKey: private_key
@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)
@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 / 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 / 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
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" ],