Skip to content

Instantly share code, notes, and snippets.

View duypv98's full-sized avatar

Jerry F duypv98

View GitHub Profile
# Install dependencies only when needed
FROM node:14-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
@keidarcy
keidarcy / apple.ts
Last active May 2, 2024 15:36
`Sign in with Apple` Nodejs typescript full example sample code
import axios from 'axios';
import * as jwt from 'jsonwebtoken';
import * as jwksClient from 'jwks-rsa';
import jwtDecode, { JwtHeader } from 'jwt-decode';
/**
* @see {@link https://github.com/expo/expo/blob/sdk-44/packages/expo-apple-authentication/src/AppleAuthentication.types.ts#L147}
* An object representing the tokenized portions of the user's full name. Any of all of the fields
* may be `null`. Only applicable fields that the user has allowed your app to access will be nonnull.
*/
@koistya
koistya / facebook-customer-chat-demo.jsx
Last active July 13, 2022 10:20
Facebook Customer Chat with Next.js
import { useState, Fragment } from 'react'
import Script from 'next/script'
/**
* Facebook Customer Chat demo
*
* @see https://nextjs.org/docs/api-reference/next/script
* @see https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin/sdk/
* @see https://developers.facebook.com/docs/javascript/reference/FB.init/
*/
@troyfontaine
troyfontaine / readme.md
Last active April 8, 2024 06:10
Resize root partition (or how to remove the default /home partition) on CentOS 7 online

Resize root partition (or how to remove the default /home partition) on CentOS 7 online

This process requires that you are able to ssh OR log in locally using the root user account and that no services be running as users out of /home on the target machine.

The examples are from a default installation with no customization-you NEED to know what you're working with for volumes/partitions to not horribly break things.

By default, CentOS 7 uses XFS for the file system and Logical Volume Manager (LVM), creating 3 partitions: /,/home and swap.

NOTE: If you want to be sure that nothing is writing to /home you can either modify the host to boot into single-user mode OR try to use the systemctl isolate runlevel1.target command to switch (not tested! should work).

@rajiteh
rajiteh / mongo_search_and_replace.js
Created February 18, 2016 17:48
Recursively search and replace a string value across all collections in a mongodb database.
/*
Recursively traverses all collections and objects/arrays contained within documents replacing every
instance of 'find' with 'replace'.
mongo <db_name> mongo_search_and_replace.js
*/
function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
@soheilhy
soheilhy / nginxproxy.md
Last active May 16, 2024 08:59
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers