Skip to content

Instantly share code, notes, and snippets.

View kvaps's full-sized avatar
🔳
This mess is mine!

Andrei Kvapil kvaps

🔳
This mess is mine!
View GitHub Profile
  • Linux VM
  • VirtIO driver
  • raid5+lvm drive
# mount /dev/vdb /btrfs/
# mount /dev/vdc /ext4/
# mount /dev/vdd /xfs/
# cd /btrfs/
# dd if=/dev/zero of=./test bs=4k count=1000000 conv=fdatasync
icecast=play.artradio.su:8000 #радио-сервер IceCast
mountpoint="/mp3_192" #имя точки монтирования
#получаем статистику с сервера
req=$(curl http://$icecast/status2.xsl -s)
#ищем точку монтирования в статистике
if [[ "$req" != *"$mountpoint"* ]];
then
echo $(date +"%y-%m-%d %T") "Watchdog: Stream not fond. Rebooting server..."
@kvaps
kvaps / le-renew-webroot
Created December 23, 2015 13:01 — forked from thisismitch/le-renew-webroot
Let's Encrypt Auto-Renewal using the Webroot Plugin (Nginx)
#!/bin/bash
web_service='nginx'
config_file="/usr/local/etc/le-renew-webroot.ini"
le_path='/opt/letsencrypt'
exp_limit=30;
if [ ! -f $config_file ]; then
echo "[ERROR] config file does not exist: $config_file"
LIST: https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv
URL: cat dump.csv|iconv -f cp1251 -t utf8|tr ' |' ' '|tr ' ' ','|tr ';' ' '|awk '{print $3}'|grep http|tr ',' '~'|sed 's/~~~/ /'|tr ' ' '\n'|sort -u
IP: cat dump.csv|iconv -f cp1251 -t utf8|tr ' |' ' '|tr ' ' ','|tr ';' ' '|awk '{print $1}'|sed 's/,,,/=/g'|tr '=' '\n'|sort -u|sed '/Updated:/d'
DOMAIN: cat dump.csv|iconv -f cp1251 -t utf8|tr ' |' ' '|tr ' ' ','|tr ';' ' '|awk '{print $2}'|sort -u
UPDATE: cat dump.csv|iconv -f cp1251 -t utf8|grep "Updated:"
@kvaps
kvaps / .profile
Last active January 25, 2016 13:57
if [ -z $OLD_HOME ]; then
export OLD_HOME=$HOME
export HOME=/tmp/$USER
mkdir -p $HOME
find $OLD_HOME -type f -exec sh -c '
path=`echo "$@" | sed "s|$OLD_HOME||g"`
mkdir -p `dirname ${HOME}${path}`
ln -s ${OLD_HOME}${path} ${HOME}${path}' _ {} \;
fi
# Password for Encription Certificate
$secret = "MyPassw0rd"
Get-ChildItem cert:\currentuser\my | Out-String -Width 512 | Out-File "$Env:USERPROFILE\Documents\info.txt"
# Copying Certificate to My Document
Get-ChildItem cert:\currentuser\my |
# Where-Object { $_.HasPrivateKey -and $_.PrivateKey.CspKeyContainerInfo.Exportable } |
Foreach-Object { [system.IO.file]::WriteAllBytes( "$Env:USERPROFILE\Documents\$($_.thumbprint).pfx" , ($_.Export('PFX', $secret )) ) }
#include <GuiListView.au3>
#include <Array.au3>
$CryptoPro = 'rundll32.exe shell32.dll,Control_RunDLL "C:\Program Files\Crypto Pro\CSP\cpconfig.cpl"'
$hCryptoPro = ''
$tCryptoProTab1 = ''
$tCryptoProTab2 = ''
$tCryptoProTab3 = ''
$hCertsInPrivContainer = ''
$tCertsInPrivContainerStep1 = ''

Write

dd if=/dev/zero of=./test bs=4k count=1000000 oflag=dsync

Read

dd if=./test if=/dev/null bs=4k count=1000000 oflag=dsync

Drop caches

check_xwin() {
if [ "$(uname -o)" == "Cygwin" ] ; then
# Check for Cygwin's Xorg
if [ -z $(whereis -b startxwin | cut -d: -f2-) ] ; then
# Start Xorg if not runned
if ! $(ps aux | grep -q XWin); then
startxwin
fi
fi
fi
#!/bin/bash
for i in $(onetemplate list -l ID -n | tail -n +2); do
onetemplate show $i | awk '/TEMPLATE CONTENTS/ {seen = 1} seen {print}' | tail -n +2 > $i
done