Skip to content

Instantly share code, notes, and snippets.

View trungx's full-sized avatar
🚩
Go to 2022

trungx

🚩
Go to 2022
View GitHub Profile
@trungx
trungx / rarreg.key
Created July 27, 2023 17:12 — forked from MuhammadSaim/rarreg.key
Step 1: Create a file called rarreg.key Step 2: Paste into the file the raw content of this gist Step 3: Go to Winrar install directory (by default => c:\ProgramFiles\WinRAR\ ) Step 4: Paste the rarreg.key into WinRAR directory Step 5: Enjoy
RAR registration data
WinRAR
Unlimited Company License
UID=4b914fb772c8376bf571
6412212250f5711ad072cf351cfa39e2851192daf8a362681bbb1d
cd48da1d14d995f0bbf960fce6cb5ffde62890079861be57638717
7131ced835ed65cc743d9777f2ea71a8e32c7e593cf66794343565
b41bcf56929486b8bcdac33d50ecf773996052598f1f556defffbd
982fbe71e93df6b6346c37a3890f3c7edc65d7f5455470d13d1190
6e6fb824bcf25f155547b5fc41901ad58c0992f570be1cf5608ba9
@trungx
trungx / vietnamese-slug.js
Created May 25, 2023 14:25 — forked from laocoi/vietnamese-slug.js
Create Vietnamese slug from string - Javascript
function slugify(string){
const a = 'àáäâãåăæąçćčđďèéěėëêęğǵḧìíïîįłḿǹńňñòóöôœøṕŕřßşśšșťțùúüûǘůűūųẃẍÿýźžż·/_,:;'
const b = 'aaaaaaaaacccddeeeeeeegghiiiiilmnnnnooooooprrsssssttuuuuuuuuuwxyyzzz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/á|à|ả|ạ|ã|ă|ắ|ằ|ẳ|ẵ|ặ|â|ấ|ầ|ẩ|ẫ|ậ/gi, 'a')
.replace(/é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ/gi, 'e')
.replace(/i|í|ì|ỉ|ĩ|ị/gi, 'i')
.replace(/ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ/gi, 'o')
.replace(/ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự/gi, 'u')
wget http://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz
tar zxvf glibc-2.18.tar.gz
cd glibc-2.18
mkdir build
cd build
../configure --prefix=/opt/glibc-2.18
make -j4
sudo make install
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/glibc-2.18/lib
@trungx
trungx / stash_dropped.md
Created December 3, 2021 03:23 — forked from joseluisq/stash_dropped.md
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@trungx
trungx / gist:28685436177c29a149028ff5501013e8
Created June 24, 2021 03:06 — forked from kapkaev/gist:4619127
MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. Resque
$ redis-cli
> config set stop-writes-on-bgsave-error no
@trungx
trungx / cheap_code.js
Created April 23, 2021 08:56
code rẻ tiền
function comparer(otherArray) {
return function(current){
return otherArray.filter(function(other){
return other.id == current.id && other.symbol == current.symbol && other.name == current.name
}).length == 0;
}
}
let origirnalList = [];
setInterval(()=> {
@trungx
trungx / gist:0e64d37d9735804209773382b66fb91a
Created March 3, 2021 13:16 — forked from madeagency/gist:79dc86e8aa09aa512af5
OSX Terminal Fix - perl: warning: Setting locale failed.
When running certain commands like ssh or git within Terminal on OSX you may get notices like the one below, which can be annoying.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
@trungx
trungx / freehosting.csv
Last active March 4, 2021 06:18
blog.trung.dev
no name diskspace bandwidth domain subdomain database ftp
1 hostinger.vn 200MB unlimited unlimited unlimited unlimited unlimited
2 123host.vn 200MB unlimited unlimited unlimited unlimited unlimited
3 gearhost.com 1GB 5GB 1 1 5 5
4 000webhost.com 1GB 5GB 1 1 1 1
@trungx
trungx / server-use.php
Created March 3, 2021 03:44
Check memory php use on server
<?php
function print_mem() {
$mem_usage = memory_get_usage();
$mem_peak = memory_get_peak_usage();
echo 'The script is now using: <strong>' . round($mem_usage / 1024) .' KB<strong> of memory.<br>';
echo 'Peak usage: <strong>' . round($mem_peak / 1024) .' KB<strong> of memory.<br>';
}
print_mem();
@trungx
trungx / linh.php
Created February 28, 2021 02:23
xx
Route::get('/getdb', function() {
try{
DB::beginTransaction();
//import province
$provinces = AU::select('l1_name', 'l1_code')->groupBy('l1_name','l1_code')->get();
//import district
foreach($provinces as $province) {