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 | |
# 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 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 | |
IPS="216.218.221.6:216.218.221.42:74.82.46.6:216.66.84.46:216.66.86.114:216.66.87.14:216.66.80.30:216.66.88.98:216.66.84.42:216.66.86.122:216.66.80.90:216.66.80.162:216.66.80.98:216.66.22.2:184.105.253.14:184.105.253.10:184.105.250.46:72.52.104.74:64.62.134.130:216.66.77.230:209.51.161.58:209.51.161.14:66.220.7.82:216.218.226.238:216.66.38.58:184.105.255.26" | |
#IPS="216.218.221.6" | |
IT="${IPS}:" | |
while [ -n "$IT" ] | |
do | |
VAL="${IT%%:*}" | |
RES=$(ping -q -n -c 9 "${VAL}" | grep -e 'rtt' | cut -d ' ' -f 4) |
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
" Fix cursor movement and backspace in insert mode for vim.tiny. | |
set nocompatible | |
set backspace=indent,eol,start |
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
# Here prefx "S" means start, and "K" means stop/kill. | |
# Two digits after mean order of start and kill operations. | |
# I have not found any standard defining this order, | |
# but orders above 90 usually are user scripts. | |
# List installed runlevels | |
ls /etc/rc.d/rc?.d/*someservice | |
# Remove from any runlevels | |
rm /etc/rc.d/rc?.d/*someservice |
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
# 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 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
# 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 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 | |
# This is /etc/sysconfig/someservice: | |
# CHARTSRVBASE="/opt/someservice" | |
# CHARTSRVRUN="/opt/someservice" | |
# CHARTSRVBIN="/opt/someservice/someservice" | |
# CHARTSRVPID="/var/run/someservice.pid" | |
# CHARTSRVLOG="/var/log/someservice/someservice-$(date +%Y%m%d%H%M%S).log" | |
######################################################################## | |
# Begin $rc_base/init.d/ | |
# Description : |
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 | |
# This script allows to resample images from whatever DPI to 75 DPI (screen resolution) | |
# in batch. I use it to prepare smallsize images of scans of my IDs, etc... | |
cd path/to/collections/base/dir | |
for fi in $(/bin/ls -1 image_collection_600dpi/*) | |
do | |
fo="$(echo $fi | sed 's/_[[:digit:]]\+dpi//g')" | |
echo convert-im6 $fi -units PixelsPerInch -resample 75 $fo |
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 | |
# Sync local date to remote host over ssh | |
ssh remote.host.net sudo date $(date "+%m%d%H%M%Y.%S") |
OlderNewer