Skip to content

Instantly share code, notes, and snippets.

View nntoan's full-sized avatar
🌀

Toan Nguyen nntoan

🌀
View GitHub Profile
@nntoan
nntoan / DataTables.js
Created September 26, 2024 08:59
DataTables.js
/**
* Check is item is object
*/
const isObject = (val) => Object.prototype.toString.call(val) === "[object Object]";
/**
* Check for valid JSON string
*/
const isJson = (str) => {
let t = !1;
try {
@nntoan
nntoan / VALET-PROMAX-V3.1.patch
Created March 25, 2023 04:33
VALET PROMAX V3.1 (2.4.0-beta5)
@package weprovide/valet-plus
@version >= 2.4.0-beta5
@after VALET-PROMAX-V3.patch
--- cli/Valet/PhpFpm.php
+++ cli/Valet/PhpFpm.php (date 1667897712772)
@@ -14,6 +14,7 @@
const PHP_V74_VERSION = '7.4';
const PHP_V80_VERSION = '8.0';
const PHP_V81_VERSION = '8.1';
+ const PHP_V82_VERSION = '8.2';
@nntoan
nntoan / VALET-PROMAX-V3.patch
Created March 25, 2023 04:32
VALET PROMAX V3 (2.4.0-beta5)
@package weprovide/valet-plus
@version >= 2.4.0-beta5
--- cli/Valet/PhpFpm.php
+++ cli/Valet/PhpFpm.php (date 1667469040112)
@@ -31,6 +31,7 @@
];
const LOCAL_PHP_FOLDER = '/etc/php/';
+ const HOMEBREW_OPT_FOLDER = '/opt/php@%s/';
@nntoan
nntoan / ubuntu2204__openssl111__issues.md
Last active March 3, 2023 10:21
Ubuntu 22.04 + OpenSSL 1.1 issue

Issue

...error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

Solution

This fixes it (a problem with packaging in 22.04):

@nntoan
nntoan / Varnish VCL Basic Authentication.md
Created August 1, 2021 13:11 — forked from Integralist/Varnish VCL Basic Authentication.md
[Varnish VCL Basic Authentication] #security #basicauth #authentication #vcl #varnish #fastly #cdn

generate a username/password

echo -n beep:boop | base64

YmVlcDpib29w

Note: it's important to use -n otherwise echo will add a line break and that can be a time consuming error to debug when you find your username/password isn't working ;-) if you do find you need to debug, then use curl with the -v flag and inspect the request headers being sent and make sure your base64 encoded username/password matches what curl generates for the Authorization header when using the --user flag (see below curl examples)

@nntoan
nntoan / aws-cli-cheatsheet.MD
Last active July 17, 2021 08:01
AWS CLI CheatSheet

Get RDS parameters group pure configuration for [mysqld]

aws rds describe-db-parameters --db-parameter-group-name YOUR_PARAMETER_GROUP_NAME --source system | jq -r '.Parameters[] | (.ParameterName + "=" + .ParameterValue)'
@nntoan
nntoan / GUIDE.md
Created February 8, 2021 04:09
Vagrant resizedisk post

Updating existing vagrant box

  • Do all of the above
  • Run vagrant halt & vagrant up (You should see something like "Resized disk: old 32768 MB, req 51200 MB, new 51200 MB")
  • SSH to vagrant box
  • Run sudo cfdisk /dev/sda
  • Use arrows to select your disk probably sdaX. Mine was sda3.
  • Then select resize using arrow keys. Accept the suggested disk size.
  • Then select write. And answer yes.
  • You can select quit now.
@nntoan
nntoan / mailhog_proxy.conf
Created July 25, 2020 15:52
MailHog Nginx Proxy
chunked_transfer_encoding on;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://127.0.0.1:8025
@nntoan
nntoan / runcloud_installer.sh
Created March 26, 2019 16:49
runcloud_installer.sh
#!/bin/bash
#
#
# RunCloud installer script for server AlmarDental Production (103.101.163.205)
# Do not use in other server
OSNAME=`lsb_release -s -i`
OSVERSION=`lsb_release -s -r`
OSCODENAME=`lsb_release -s -c`
@nntoan
nntoan / dnsmasq_ubuntu_bionic_beaver.md
Last active July 23, 2018 06:30
Enable Dnsmasq Ubuntu 18.04

Enable dnsmasq in NetworkManager

Edit the file /etc/NetworkManager/NetworkManager.conf, and add the line dns=dnsmasq to the [main] section, it will look like this :

[main]
plugins=ifupdown,keyfile
dns=dnsmasq

[ifupdown]