This file contains 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 | |
# Iterate over an array using POSIX Shell | |
# Initial data | |
ARR="a:b:c:d" | |
# Iteration. Do whatever is needed instead of 'echo "$VAL"'. | |
CDR="${ARR}:"; while [ -n "$CDR" ]; do CAR=${CDR%%:*}; echo "$CAR"; CDR=${CDR#*:}; done; unset CAR CDR | |
# IMPORTANT!!! Add semicolon to the end of an array (IT="${ARR}:") to make stop condition working. |
This file contains 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
# This script allows to determine MaxTranssmitUnit size for current network. | |
# | |
# Argument "-M" selects Path MTU Discovery strategy: - "do" means prohibit | |
# fragmentation, even local one; - "want" do PMTU discovery, fragment locally | |
# when packet size is large; - "dont" do not set DF flag. | |
# | |
# Argument "-s" specifies payload size. Value 1472 produces frames of 1500 bytes. | |
# And value 1473 is for frames 1501 byte which is more than usual MTU. | |
# | |
# Arguments "-c 3 -A" are used to send 3 packets as fast as possible (adaptive ping). |
This file contains 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
# Prepare | |
mkdir -p "${HOME}/path without/symlinks"; ln -s "${HOME}/path without" "${HOME}/path with" | |
TESTPATH="${HOME}/..///${USER}/path with/symlinks///"; echo "${TESTPATH}" | |
echo "Absolute path: '$(realpath -m ${TESTPATH})'" | |
echo "Canonical path: '$(realpath -s -m ${TESTPATH})'" | |
echo "Relative to '/usr/bin': '$(realpath -s -m --relative-to="/usr/bin" ${TESTPATH})'" | |
echo "Canonical relative to '/usr/bin': '$(realpath -m --relative-to="/usr/bin" ${TESTPATH})'" | |
echo "Relative with base '/usr/bin': '$(realpath -s -m --relative-base="/usr/bin" ${TESTPATH})'" |
This file contains 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
select to_timestamp('1970-01-01T00:00:00.000Z', 'YYYY-MM-DD"T"HH24:MI:SS.FFF"Z"') as ts from dual; |
This file contains 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
CNT=1; ERR=0; while test $ERR -eq 0; do printf "Attempt: %3d at %s\n" $CNT "$(date)"; ssh -o 'VisualHostKey=no' root@192.168.21.72 /sbin/reboot; ERR=$?; test $ERR -eq 0 && sleep $((2 * 60)); CNT=$CNT+1; done; test $ERR -ne 0 && printf "Failed with code %d at %s" $ERR "$(date)" && paplay /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga |
This file contains 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 | |
# Since we're dealing with dd, abort if any errors occur | |
set -e | |
SOURCE_FILE=${1:-/dev/zero} | |
TEST_FILE=${2:-dd_obs_testfile} | |
[ -e "$TEST_FILE" ]; TEST_FILE_EXISTS=$? | |
TEST_FILE_SIZE=${3:-$((128*1024*1024))} # 128Mb |
This file contains 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
if [ "${0#/*profile*}" != "${0}" ] | |
then | |
BASEDIR=$(dirname "$(readlink -f "$0")") | |
else | |
if [ $# -gt 0 -a "${1#/*profile*}" != "${1}" ] | |
then | |
BASEDIR=$(dirname "$(readlink -f "$1")") | |
else | |
echo 'NOTE: When sourcing this profile on some shells (e.g. Busybox) you need to profile file name twice.' | |
echo 'Usage: . path/to/profile path/to/profile' |
This file contains 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
// Go to "Administration > Portal Configuration" | |
// Replace donation box at "'About' Column" with: | |
<div style="padding:8px;"><a id="googlesearchlink" href="https://google.com/">Google</a></div> | |
<div style="padding:8px;"><a id="yandexsearchlink" href="https://yandex.ru/">Yandex</a></div> | |
<div style="padding:8px;"><a id="wikisearchlink" href="https://wikipedia.org/">Wikipedia</a></div> | |
<script> | |
function updateSearchLink(elid, hrefPref, captionPref, srch) { | |
var searchlink = document.getElementById(elid); |
This file contains 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 | |
OUT="result" convert source1.tiff source1.tiff ... -depth 75 -units pixelsperinch -compress zip $OUT.pdf && pdf2ps $OUT.pdf && ps2pdf $OUT.ps && rm -f $OUT.ps |
NewerOlder