Skip to content

Instantly share code, notes, and snippets.

View lamngockhuong's full-sized avatar
🍊
Working

Lâm Ngọc Khương lamngockhuong

🍊
Working
View GitHub Profile
@lamngockhuong
lamngockhuong / disable-merge-for-github-pr.userscript.js
Last active October 10, 2024 03:14
Disable Regular/Squash Merge for GitHub Pull-Request
// ==UserScript==
// @name Disable Merge for GitHub PR
// @namespace https://gist.github.com/search?q=user%3Alamngockhuong+filename%3Auserscript+language%3Ajs&ref=searchresults
// @version 0.7
// @description Automatically disable regular/squash merge on target branch for GitHub PRs
// @icon64 data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAD3VJREFUeF7VWwlwlFWe/70vFzkgJIQg35c0kXNlSllELrlmpsRVyiqMHAXWOu6MirI4HngMusiMyjVlFBhWQXSgGGfd4giLU86wqDUFKETEUDgKu8iZ4+tIEnKQgxydfuvvdX9NJ+nufF+n2XX/VV2B7nf+3v9+/ydwnemsrucmCDFZAmM0KW+SQB6EGCSk7A8gyT99K4SohZSXhBAXJfDfGnACQFGOaZZfzyWKWA8uAVE6ePAUTdPmSilnQYgRvZzjDIA/Syl3u9zuIwKQvRyvU/eYAVDicmXA41kkhHgEwDBrFpGcjKTx45F4yy2IHzZMfeIGDoSWlgaRlqaaycZGeBsb0VFVBc/Zs/CcO4e2r79G67FjkFevBhYsgLNeKd9BfPw7Q0pLa2MBRK8BKMvJyYTX+7wElkAItSNtwACk3HsvUmbNQuLYsRCJiVGtVba1oe34cTTv24fmvXvhvXzZGqcRwEYhREFueXlNVIP7O0UNgAS0El3/Z02IlwFkcrykiRPR97HH0OcnP4GIj+/Nurr1lR4PWv76VzRs3ozWL76wfq+BlCty3e5NAvBGM2FUAJi6PqpDiO0AJqqNT5qE9OeeUwCEotbWVrS0tIB/
@lamngockhuong
lamngockhuong / auto-select-merge-type-for-github-pr.userscript.js
Last active October 10, 2024 03:15
Auto Select Merge Type for GitHub Pull-Request
// ==UserScript==
// @name Auto Select Merge Type for GitHub PR
// @namespace https://gist.github.com/search?q=user%3Alamngockhuong+filename%3Auserscript+language%3Ajs&ref=searchresults
// @version 0.7
// @description Automatically selects merge type based on target branch for GitHub PRs
// @icon64 data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAD3VJREFUeF7VWwlwlFWe/70vFzkgJIQg35c0kXNlSllELrlmpsRVyiqMHAXWOu6MirI4HngMusiMyjVlFBhWQXSgGGfd4giLU86wqDUFKETEUDgKu8iZ4+tIEnKQgxydfuvvdX9NJ+nufF+n2XX/VV2B7nf+3v9+/ydwnemsrucmCDFZAmM0KW+SQB6EGCSk7A8gyT99K4SohZSXhBAXJfDfGnACQFGOaZZfzyWKWA8uAVE6ePAUTdPmSilnQYgRvZzjDIA/Syl3u9zuIwKQvRyvU/eYAVDicmXA41kkhHgEwDBrFpGcjKTx45F4yy2IHzZMfeIGDoSWlgaRlqaaycZGeBsb0VFVBc/Zs/CcO4e2r79G67FjkFevBhYsgLNeKd9BfPw7Q0pLa2MBRK8BKMvJyYTX+7wElkAItSNtwACk3HsvUmbNQuLYsRCJiVGtVba1oe34cTTv24fmvXvhvXzZGqcRwEYhREFueXlNVIP7O0UNgAS0El3/Z02IlwFkcrykiRPR97HH0OcnP4GIj+/Nurr1lR4PWv76VzRs3ozWL76wfq+BlCty3e5NAvBGM2FUAJi6PqpDiO0AJqqNT5qE9OeeUwCEotbWVrS
@lamngockhuong
lamngockhuong / guide-mock-private-func-by-jest.md
Last active August 12, 2024 16:23
Test & mock private function by jest
export class Test {
  constructor() {}

  private testPri(a: string): string {
    return a + 'test';
  }
}
@lamngockhuong
lamngockhuong / puppeteer.Dockerfile
Last active August 7, 2024 05:15
Dockerfile for nodejs 20 alpine, yarn 4.x and puppeteer. Tested on Local development, Cloud Run
##################
# BUILD BASE IMAGE
##################
FROM node:20-alpine AS base
ENV YARN_VERSION=4.1.1
# Install and use yarn 4.x
RUN corepack enable && corepack prepare yarn@${YARN_VERSION} --activate
@lamngockhuong
lamngockhuong / list-all-tables.sql
Created August 6, 2024 10:33
List all tables that need to be dropped from the public schema.
select 'drop table if exists "' || tablename || '" cascade;' from pg_tables where schemaname = 'public';
@lamngockhuong
lamngockhuong / font
Created November 2, 2022 08:31
Check font
javascript:(function(){if(!document.getElementById('fountscript')){var founts=document.createElement('script');founts.src='https://fount.artequalswork.com/fount.js';founts.id='fountscript';document.body.appendChild(founts);}})();
@lamngockhuong
lamngockhuong / readme.md
Created July 16, 2019 00:56
How to change the ubuntu login screen
$ sudo gedit /usr/share/gnome-shell/theme/ubuntu.css

Find "#lockDialogGroup" keyword:

alt text

Replace with:

#lockDialogGroup {
@lamngockhuong
lamngockhuong / .htaccess
Created July 14, 2019 02:14
Redirect all path to index.html root file - ReactJS on hosting
RewriteBase /
RewriteCond %{REQUEST_URI} !^/(static/?|$)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
@lamngockhuong
lamngockhuong / readme.md
Created May 21, 2019 09:57
npm test error with jest on reactjs (ubuntu)

Error on ubuntu

> react-scripts test

Error: watch /home/lam.ngoc.khuong/develop/project/my-workspace/react/learn-react/hackernews/node_modules/accepts ENOSPC
    at FSWatcher.start (fs.js:1382:19)
    at Object.fs.watch (fs.js:1408:11)
    at NodeWatcher.watchdir (/home/lam.ngoc.khuong/develop/project/my-workspace/react/learn-react/hackernews/node_modules/sane/src/node_watcher.js:159:22)
    at Walker.<anonymous> (/home/lam.ngoc.khuong/develop/project/my-workspace/react/learn-react/hackernews/node_modules/sane/src/common.js:109:31)
    at emitTwo (events.js:126:13)
@lamngockhuong
lamngockhuong / ConsumeHeap.java
Created May 3, 2019 07:19 — forked from mosheeshel/ConsumeHeap.java
Function to fill JVM/Java Heap, Java options to automatically create a Heapdump on that event and a companion script to upload resulting files to S3
import java.io.IOException;
import java.util.Vector;
/**
* Created by moshee
* on: 07/06/17
* to compile in place: `javac ConsumeHeap.java`
* Execute: `java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/app-`date +%s`-pid$$.hprof -XX:OnOutOfMemoryError=/opt/app/bin/upload_dump_s3.sh -Xmx2m ConsumeHeap`
* HeapDumpOnOutOfMemoryError specifies to automatically create a dump when OOM occures
* HeapDumpPath supplies a path to put that file