Skip to content

Instantly share code, notes, and snippets.

@GarryOne
GarryOne / python-auth0-user-tenant-migration.py
Created October 25, 2023 23:51
Migrating Users from One Auth0 Tenant to Another in Python: Handling Large Payloads
import gzip
import json
import time
import requests
export_management_token = "YOUR_MANAGEMENT_TOKEN" # Replace with your token
domain = "YOUR_SOURCE_TENANT_DOMAIN" # Replace with your source tenant's domain
connection_id = "YOUR_CONNECTION_ID" # Replace with your connection ID
export_url = f'https://{domain}/api/v2/jobs/users-exports'
@GarryOne
GarryOne / react-memo-deep-objects-comparison.js
Created December 13, 2022 21:05
React Memo comparison deep objects using JSON.stringify()
export const isPrimitive = (val) => {
if (val === null) {
return true;
}
if (typeof val === "object" || typeof val === "function") {
return false;
} else {
return true;
}
@GarryOne
GarryOne / tic-tac-toe-v2.js
Last active June 23, 2022 16:39
Tic Tac Toe v2
<style>
.container {
display: flex;
flex-direction: column;
}
.row {
display: flex;
}
@GarryOne
GarryOne / tic-tac-toe-v1.js
Created June 23, 2022 15:25
Tic Tac Toe - v1
<style>
.container {
display: flex;
flex-direction: column;
}
.row {
display: flex;
}
@GarryOne
GarryOne / ebay-taxonomies-categories.json
Created May 27, 2022 13:24
eBay Taxonomies Categories Names by categoryID
{
"1": "Collectibles",
"12": "Other Antiques",
"28": "Other Collectible Metalware",
"30": "Other Vintage & Antique Toys",
"34": "Advertising",
"35": "Other Merch & Memorabilia Ads",
"36": "Soda",
"37": "Other Soda Memorabilia",
"38": "Other Coca-Cola Ads",
@GarryOne
GarryOne / useTranslation-custom-implementation.ts
Created March 24, 2022 12:00
Custom implementation of useTranslation() from i18next
import Cookies from 'js-cookie';
import enTrans from '@public/locales/en';
import deTrans from '@public/locales/de';
import esTrans from '@public/locales/es';
import { DEFAULT_LOCALE } from 'src/global/constants';
const useCustomTranslation = () => {
const translationsByLocale = {
en: enTrans,
de: deTrans,
@GarryOne
GarryOne / save-twilio-compositions-to-s3-bucket.php
Last active March 28, 2021 19:50
Save Twilio Video Compositions to AWS S3 bucket | PHP Script
<?php
//
// You'll need to install the following composer packages:
// "twilio/sdk": "^6.20",
// "aws/aws-sdk-php": "~3.0",
// "guzzlehttp/guzzle": "^7.0"
ini_set( 'memory_limit', '-1' );
set_time_limit(0);
@GarryOne
GarryOne / node_postgres_fix_table_identity.js
Last active November 24, 2022 13:46
Node Postgres Fix Table IDENTITY seq / autoincrement / nextval
const pg = require('pg');
const { Client } = pg;
const updateTables = async () => {
const client = new Client({
connectionString:
'postgresql://cysiamadmin@rav-ravhe7-db:JraWQiOiJ4Um@rav-ravhe7-db.postgres.database.azure.com:5432/postgres?schema=public',
ssl: {
rejectUnauthorized: false,
},
@GarryOne
GarryOne / eslintrc.js
Last active March 28, 2021 19:54
ESLint/TSLint configuration with typescript, prettier. Works with auto-fix for removing unused imports, separating imports...
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin', 'unused-imports', 'import'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
@GarryOne
GarryOne / nodejs-ssh-deploy.yml
Created March 28, 2020 12:14
Github workflow for deploying app nodejs app through ssh
name: Node.js CI
on:
push:
branches:
- master
jobs:
deploy: