Skip to content

Instantly share code, notes, and snippets.

View anhtuank7c's full-sized avatar

Tuan Nguyen anhtuank7c

View GitHub Profile
@anhtuank7c
anhtuank7c / rbac
Last active September 20, 2024 18:22
Casbin RBAC - Role Base Access Control
# model.conf
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[role_definition]
g = _, _ # Role inheritance between users and roles
g2 = _,_ # Resource management between users and resources
@anhtuank7c
anhtuank7c / rbac_with_resource_roles
Last active September 20, 2024 18:22
Casbin RBAC with resource roles example
# model.conf
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[role_definition]
g = _, _ # Role inheritance between users and roles
@anhtuank7c
anhtuank7c / @react-native-firebase+app+20.0.0.patch
Created August 27, 2024 13:49
Expo Firebase patch that ensure to remove the auth session once app got deleted
diff --git a/node_modules/@react-native-firebase/app/plugin/build/ios/appDelegate.js b/node_modules/@react-native-firebase/app/plugin/build/ios/appDelegate.js
index 8cf92f0..7840ebb 100644
--- a/node_modules/@react-native-firebase/app/plugin/build/ios/appDelegate.js
+++ b/node_modules/@react-native-firebase/app/plugin/build/ios/appDelegate.js
@@ -7,7 +7,13 @@ exports.withFirebaseAppDelegate = exports.modifyAppDelegateAsync = exports.modif
const config_plugins_1 = require("@expo/config-plugins");
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
const fs_1 = __importDefault(require("fs"));
-const methodInvocationBlock = `[FIRApp configure];`;
+const methodInvocationBlock = `[FIRApp configure];
@anhtuank7c
anhtuank7c / bootable-win-on-mac.md
Created August 10, 2024 13:24 — forked from acarril/bootable-win-on-mac.md
Create a bootable Windows USB using macOS

For some reason, it is surprisingly hard to create a bootable Windows USB using macOS. These are my steps for doing so, which have worked for me in macOS Monterey (12.6.1) for Windows 10 and 11. After following these steps, you should have a bootable Windows USB drive.

1. Download a Windows disc image (i.e. ISO file)

You can download Windows 10 or Windows 11 directly from Microsoft.

2. Identify your USB drive

After plugging the drive to your machine, identify the name of the USB device using diskutil list, which should return an output like the one below. In my case, the correct disk name is disk2.

@anhtuank7c
anhtuank7c / AdbCommands
Created August 5, 2024 00:51 — forked from Pulimet/AdbCommands
Adb useful commands list
Hi All!
I've recently launched a tool that wraps many of the commands here with a user interface. This desktop application is currently available for macOS. There's a roadmap outlining planned features for the near future.
Feel free to request any features you'd like to see, and I'll prioritize them accordingly.
One of the most important aspects of this application is that every command executed behind the scenes is displayed in a special log section. This allows you to see exactly what’s happening and learn from it.
Here's the link to the repository: https://github.com/Pulimet/ADBugger
App Description:
ADBugger is a desktop tool designed for debugging and QA of Android devices and emulators. It simplifies testing, debugging, and performance analysis by offering device management, automated testing, log analysis, and remote control capabilities. This ensures smooth app performance across various setups.
@anhtuank7c
anhtuank7c / install-nginx-mariadb-phpfpm-on-ubuntu-20.04.md
Created April 8, 2024 10:28 — forked from nd3w/install-nginx-mariadb-phpfpm-on-ubuntu-20.04.md
How to Install Nginx, MariaDB, PHP-FPM on Ubuntu 20.04

How to Install Nginx, MariaDB, PHP-FPM on Ubuntu 20.04

This is a way to install and set up Nginx, MariaDB and PHP-FPM on Ubuntu 20.04.

NOTE: This has been prepared for ease of use in mind, not security, mostly in development machine. Please do not use these instructions to setup on a public server environment. Use other proper manuals instead.

$ sudo apt update

Nginx

@anhtuank7c
anhtuank7c / AesUtil.ts
Created March 17, 2024 03:11 — forked from btxtiger/AesUtil.ts
Node.js - AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
/**
* Cryptography Functions
*
* Forked from AndiDittrich/AesUtil.js
* https://gist.github.com/AndiDittrich/4629e7db04819244e843
*/
import crypto, { CipherGCM, CipherGCMTypes, DecipherGCM } from 'crypto';
import { Password } from './types';
@anhtuank7c
anhtuank7c / clean_code.md
Created January 21, 2024 09:03 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@anhtuank7c
anhtuank7c / README.md
Last active January 17, 2024 03:08
Loại bỏ giọng nói trong video
@anhtuank7c
anhtuank7c / cloudflare_workflow.yaml
Created January 7, 2024 07:18
Github workflow for deploying Sveltekit app to Cloudflare Pages
# Deploy to Cloudflare Workers/Pages with Wrangler
# https://github.com/marketplace/actions/deploy-to-cloudflare-workers-with-wrangler
name: Deploy Pages
on:
push:
branches:
- main
pull_request:
jobs:
deploy: