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 / app.js
Created December 7, 2024 11:08 — forked from mikegc-aws/app.js
Claude 3 Haiku - Amazon Bedrock - NodeJS text and image prompt.
// Adapted from code here: https://docs.aws.amazon.com/code-library/latest/ug/bedrock-runtime_code_examples_actions.html
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { fileURLToPath } from "url";
import {
AccessDeniedException,
BedrockRuntimeClient,
@Zonalds
Zonalds / linkedinCompany.js
Created November 12, 2024 17:51 — forked from nicosh/linkedinCompany.js
Simple way to scrape linkedin company employees with puppeteer
// A simple and raw example on how to scrape company employees data.
// this script will save the ouput in a .json file.
// the script needs your cookies to login.
// For Educational Purposes Only :)
const puppeteer = require('puppeteer');
const fs = require('fs');
const cookies = require('./cookies.json');
const API_ENDPOINT = "https://www.linkedin.com/voyager/api/search/hits?"
@Zonalds
Zonalds / tips_increase_memory_limit_nodejs.md
Last active November 21, 2024 09:53 — 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)