This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function has_with( string $haystack, $needles ) { | |
| foreach ( (array) $needles as $needle ) { | |
| if ( false !== strpos( $haystack, (string) $needle ) ) { | |
| return true; | |
| } | |
| } | |
| return false; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1) Create a branch with the tag | |
| git branch {tagname}-branch {tagname} | |
| git checkout {tagname}-branch | |
| 2) Include the fix manually if it's just a change .... | |
| git add . | |
| git ci -m "Fix included" | |
| or cherry-pick the commit, whatever is easier | |
| git cherry-pick {num_commit} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # 1) edit /etc/pam.d/sshd | |
| # 2) append to bottom /etc/pam.d/sshd | |
| # session optional pam_exec.so seteuid /usr/sbin/notifysshlogin | |
| if [ "$PAM_TYPE" != "close_session" ]; then | |
| # echo "user: {$PAM_USER} IP: {$PAM_RHOST}"; | |
| # your mail command | |
| fi | |
| exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # This script prints out all of your Redis keys and their size in a human readable format | |
| # Copyright 2013 Brent O'Connor | |
| # License: http://www.apache.org/licenses/LICENSE-2.0 | |
| human_size() { | |
| awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } ' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kernel.msgmnb = 65536 | |
| kernel.msgmax = 65536 | |
| # use default | |
| #kernel.shmmax = 68719476736 | |
| #kernel.shmall = 16777216 | |
| fs.file-max = 2097152 | |
| vm.swappiness = 10 | |
| vm.dirty_ratio = 60 | |
| vm.dirty_background_ratio = 2 | |
| net.ipv4.tcp_synack_retries = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # hugepages_settings.sh | |
| # https://kerneltalks.com/services/what-is-huge-pages-in-linux/ | |
| # | |
| # Linux bash script to compute values for the | |
| # recommended HugePages/HugeTLB configuration | |
| # | |
| # Note: This script does calculation for all shared memory | |
| # segments available when the script is run, no matter it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function _basehost() { | |
| if ( !empty($_SERVER["HTTP_HOST"]) ) { | |
| $schema = ( !empty($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"]) == "on") ? "https://": "http://"; | |
| $host = $_SERVER["HTTP_HOST"]; | |
| return $schema.$host; | |
| } | |
| return null; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # please refer to https://github.com/nawawi/nginx-cache-data/blob/master/nginx-proxy-cache-data.sh | |
| cat /tmp/nginx-proxy-cache-data/data-file-cache.txt |grep -v ^# |tr -s '|' ' ' |while read _host _size _url; do | |
| _purge="$(echo $_url|sed -e "s/$_host/${_host}\/purge/g")"; | |
| _output="$(curl -s -H "Host: ${_host}" ${_purge}*)"; | |
| echo $_output; | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @{* | |
| Name: quotation total quantity | |
| Date: 07082019 | |
| *} | |
| @{* TEMPLATE SETTING *} | |
| @{$TITLE="Quotation"} | |
| @{$SUBJECT=""} | |
| @{$SHOW_STATUS=true} | |
| @{$SHOW_DISCOUNT_PERCENT=false} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # nawawi: purge cloudflare cache | |
| _EMAIL=""; | |
| _GLOBAL_API_KEY=""; | |
| _ZONE_ID=""; | |
| echo ""; | |
| _BUFF="$(curl -s -X POST "https://api.cloudflare.com/client/v4/zones/${_ZONE_ID}/purge_cache" \ | |
| -H "X-Auth-Email: ${_EMAIL}" \ |