Skip to content

Instantly share code, notes, and snippets.

View nguyenhx2's full-sized avatar

Hoang Xuan Nguyen nguyenhx2

View GitHub Profile
@nguyenhx2
nguyenhx2 / fb-video-downloader-script.js
Created July 10, 2022 04:20 — forked from monokaijs/fb-video-downloader-script.js
A small snippet to help you download Facebook video at ease...
/**
** Author: @MonokaiJs
** Contact: [email protected] | https://fb.me/monokaijssss | monokaijs.com
**
** Free to use, but don't abuse :>
**/
(()=>{let a=location.href.match(/\/(?:videos|reel|watch)(?:\/?)(?:\?v=)?(\d+)/);if(a.length<2){console.log("Please open a video before running this script.");return}let c=function(d,e){let f=[],a;for(a in d)if(d.hasOwnProperty(a)){let g=e?e+"["+a+"]":a,b=d[a];f.push(null!==b&&"object"==typeof b?c(b,g):encodeURIComponent(g)+"="+encodeURIComponent(b))}return f.join("&")},b=function(a,b){return fetch("https://www.facebook.com/api/graphql/",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:c({doc_id:a,variables:JSON.stringify(b),fb_dtsg:require("DTSGInitialData").token,server_timestamps:!0})})};console.log("Getting info..."),b("5279476072161634",{UFI2CommentsProvider_commentsKey:"CometTahoeSidePaneQuery",caller:"CHANNEL_VIEW_FROM_PAGE_TIMELINE",displayCommentsContextEnableComment:null,displayCommentsContextIsAdPreview:null,displayComm
@nguyenhx2
nguyenhx2 / appsscript.js
Created February 10, 2022 09:51 — forked from TomTasche/appsscript.js
Remove access for user from multiple files on Google Drive - https://blog.tomtasche.at/2018/02/remove-user-from-multiple-documents.html
function main() {
findSharedDocuments("[email protected]");
}
function findSharedDocuments(email) {
var files = DriveApp.searchFiles('("' + email + '" in readers OR "' + email + '" in writers) AND NOT ("' + email + '" in owners)');
var success = 0;
while (files.hasNext()) {
var file = files.next();
try {
@nguyenhx2
nguyenhx2 / whatFilesHaveIShared.gs
Created February 10, 2022 09:51 — forked from danjargold/whatFilesHaveIShared.gs
Google script to list (on a Google Sheet) all files shared in your google drive, including all viewers, editors, and sharing permissions. Credit goes to @woodwardtw (https://gist.github.com/woodwardtw/22a199ecca73ff15a0eb) as this is an improvement on his code which only assesses a single folder and one level of sub-folders down.
function listFolders(folder) {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow(["Name", "Sharing Access", "Sharing Permission", "Get Editors", "Get Viewers", "Date", "Size", "URL", "Download", "Description", "Type"]); //writes the headers
//var folder = DriveApp.getFolderById("INSERT_YOUR_FILE_ID");//that long chunk of random numbers/letters in the URL when you navigate to the folder
//getLooseFiles(folder, sheet);
//getSubFolders(folder, sheet);
//instead of getting folder by ID rather get all folders and cycle through each. Note this will miss loose files in parent directory.
var folder = DriveApp.getFolders()
@nguyenhx2
nguyenhx2 / ExpressionExtensions.cs
Created January 28, 2022 01:19 — forked from kcuzner/ExpressionExtensions.cs
Extensions for concatenation of existing expressions using AndAlso and OrElse into a new expression
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace ETP
{
/// <summary>
@nguyenhx2
nguyenhx2 / Alternative_Excel_Unlock
Created June 8, 2021 02:32 — forked from vaderj/Alternative_Excel_Unlock
#VBA Two methods of unlocking a locked excel sheet:VBA macro for Excel that should unprotect a password protected sheet,Opening the spreadsheet as XML and removing the specific piece
Step 1. Make a copy of the spreadsheet in an empty directory. Rename the extension to .zip
Step 2. Extract the zip file.
Step 3. In the extracted contents, goto the folder \xl\worksheets\
Step 4. There should be one xml file per sheet? I editing "sheet1.xml" with NotePad++. From nearly the very end of the file, remove the tag that starts with:
<sheetProtection
My entire tag was as follows:
<sheetProtection algorithmName="SHA-512" hashValue="ALciNBSIqRcjDiFbCuyWoGk4iOcC/ZRKnEjwEVi1skb6G5JbHhp+QVZ9+rlPVbGILOS7lYiCvJmR4Q7IuSphXA==" saltValue="8OVKXrG0VacLOLVztUpEYw==" spinCount="100000" sheet="1" objects="1" scenarios="1" selectLockedCells="1"/>
Step 5. Save the file. Open the ZIP file in 7zip, find the same file, drag and drop, save, exit, rename the file back to (xlsx) and open
@nguyenhx2
nguyenhx2 / remove-pass.vb
Created June 8, 2021 02:26 — forked from yevrah/remove-pass.vb
Excel: Remove Excel Password
' src: http://www.mcgimpsey.com/excel/removepwords.html
'
' Removing Internal XL passwords
'
' Note: For a discussion of File or VBA Project password protection, see here.
'
' Internal XL passwords are about as useful for security as tissue paper. The
' reason is that the passwords you enter (i.e., with Tools/Protect/Protect
' Worksheet or /Protect Workbook) are not used directly in protection. Instead
' they are hashed (mathematically transformed) into a much less secure code.
Attribute VB_Name = "PasswordBreaker"
Sub PasswordBreaker()
'Breaks worksheet password protection.
Dim a As Integer, b As Integer, c As Integer, d As Integer, e As Integer, f As Integer
Dim g As Integer, h As Integer, i As Integer, j As Integer, k As Integer, l As Integer
On Error Resume Next
For a = 65 To 66: For b = 65 To 66: For c = 65 To 66: For d = 65 To 66: For e = 65 To 66: For f = 65 To 66
For g = 65 To 66: For h = 65 To 66: For i = 65 To 66: For j = 65 To 66: For k = 65 To 66: For l = 32 To 126
@nguyenhx2
nguyenhx2 / remove_password_excel.R
Created June 8, 2021 02:22 — forked from markheckmann/remove_password_excel.R
Remove sheet's password protection in Excel
# remove sheet protection in Excel
# Sample file: https://www.dropbox.com/s/4ul0kowrscyr8cz/excel_protected.xlsx?dl=0
library(stringr)
library(zip)
# file with protected sheets
file <- "data/excel_protected.xlsx"
# file name and path after removing protection

Domain events**

  • run in memory, only for intra-domain communication, within the same transaction scope
  • raised from the domain entity class before transaction is committed

Integration events

  • cross transactions, to propagate state changes to other microservices
@nguyenhx2
nguyenhx2 / event-loop.md
Created December 21, 2020 16:26 — forked from jesstelford/event-loop.md
What is the JS Event Loop and Call Stack?

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code