Skip to content

Instantly share code, notes, and snippets.

@nhahv
nhahv / webmin-install.md
Last active September 15, 2021 04:22
Webmin

#Install Webmin on Centos 7

Reference [^ref]

cat <<EOF >> /etc/yum.repos.d/webmin.repo
[Webmin]
@nhahv
nhahv / settings.json
Created August 28, 2021 05:07
My VSCode Settings for Next.JS
{
"adobeScriptRunner.winPhotoshopExe": "C:/Program Files/Adobe/Adobe Photoshop 2020/Photoshop.exe",
"blockman.n03MaxDepth": 20,
"blockman.n05CustomColorOfDepth0": "none",
"blockman.n06CustomColorOfDepth1": "none",
"blockman.n07CustomColorOfDepth2": "none",
"blockman.n08CustomColorOfDepth3": "none",
"blockman.n09CustomColorOfDepth4": "none",
"blockman.n10CustomColorOfDepth5": "none",
"blockman.n11CustomColorOfDepth6": "none",
@nhahv
nhahv / debian-ubuntu-zsh-setup.bash
Created May 28, 2021 04:34
debian-ubuntu-zsh-setup.bash
apt-get update && apt-get install -y git zsh vim curl
echo 'Y\n' | sh -c "\$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions.git $HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
sed -i 's/plugins=(git)/plugins=(zsh-autosuggestions zsh-syntax-highlighting)/g' ~/.zshrc
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="agnoster"/g' ~/.zshrc
@nhahv
nhahv / replace_mapDispatchToProps.md
Created March 18, 2021 01:55
Replace mapDispatchToProps Map to Function

Find

(?si)^const mapDispatchToProps = \{([^(}/)]*)?\};

Replace

const mapDispatchToProps = (dispatch, ownProps) => {
    return bindActionContextCreators({$1}, dispatch, { xPath: ownProps.xPath });
};
(?si)<\s*small className="text-danger"[^>]*>.*<InvalidFeedback(.*)<\/small>
<small className="text-danger">{edup.error && "Có lỗi xảy ra"}</small>
<small className="text-danger">
<InvalidFeedback name="username" />
</small>
@nhahv
nhahv / docker-nginx-image-proxy-server.conf
Last active February 4, 2021 05:29
docker-nginx-image-proxy-server.conf - Custom config with cross origin
proxy_cache_path /tmp/nginx/cache levels=1:2 keys_zone=remoteimages:10m max_size=1g inactive=45m;
server {
listen 80;
listen [::]:80 ipv6only=on;
listen 443 ssl;
listen [::]:443 ipv6only=on ssl;
ssl_certificate /etc/nginx/ssl/placeholder-fullchain.crt;
@nhahv
nhahv / redux-forward-ref-usage-typescipt.ts
Created November 17, 2020 02:07
Redux Forward Ref Usage
type I_PROPS = object
type I_STATE = object
class UnconnectedRoom extends React.Component {
render() {
return null
}
someMethod() {
console.log('called method')
}
@nhahv
nhahv / nginx.conf
Created October 4, 2019 02:47 — forked from phpdude/nginx.conf
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@nhahv
nhahv / cloudSettings
Created May 25, 2019 09:58 — forked from kelset/cloudSettings
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-12-18T16:41:28.295Z","extensionVersion":"v3.2.4"}
@startuml
'**************************************************************************
' GENERAL USAGE
'**************************************************************************
'title Mother\nFucker
'center header
' <font color=red>Warning:</font>
' Do not use in production.