Skip to content

Instantly share code, notes, and snippets.

View rwasef1830's full-sized avatar

Raif Atef rwasef1830

View GitHub Profile
@rwasef1830
rwasef1830 / disktest.sh
Last active April 29, 2023 08:01
fio server i/o test script
#!/bin/sh
fio --name=seqread --rw=read --direct=1 --ioengine=libaio --bs=8k --numjobs=8 --size=1G --runtime=600 --group_reporting
rm -f seq*
fio --name=seqwrite --rw=write --direct=1 --ioengine=libaio --bs=32k --numjobs=4 --size=2G --runtime=600 --group_reporting
rm -f seq*
fio --name=randread --rw=randread --direct=1 --ioengine=libaio --bs=8k --numjobs=16 --size=1G --runtime=600 --group_reporting
rm -f rand*
fio --name=randwrite --rw=randwrite --direct=1 --ioengine=libaio --bs=64k --numjobs=8 --size=512m --runtime=600 --group_reporting
rm -f rand*
fio --name=randrw --rw=randrw --direct=1 --ioengine=libaio --bs=16k --numjobs=8 --rwmixread=90 --size=1G --runtime=600 --group_reporting
#!/bin/sh
set -e
echo Pulling latest image...
docker pull webdevops/php-apache-dev:7.4-alpine
echo Pruning old images...
docker image prune -f
[ -f ".docker-dev-server" ] && LOCALPORT=$(cat .docker-dev-server | tr -d " \t\n\r" )
[ ! -z "$LOCALPORT" ] && PORTPARAM="$LOCALPORT:443"
[ -z "$PORTPARAM" ] && PORTPARAM=443
WSLIP=$(ip addr show dev eth0 | grep "inet " | cut -f6 -d" " | cut -f1 -d/)
@rwasef1830
rwasef1830 / gist:342eff5ba079644c66c79e3b7d36996c
Created September 29, 2020 10:09
How to convert GPT Dynamic RAID-1 Windows Disk to Basic Disks
This info is scarce on the web, so I'm posting it here for future reference:
1. Boot with a Linux LiveCD (eg: System-Rescue-CD).
2. Open the disk with cfdisk.
3. Change the partition type of the data partitions from Microsoft Dynamic Data to Microsoft Basic Data.
4. Delete the Microsoft LDM Metadata reserved partition
5. Delete the Microsoft Reserved partition (the LDM metadata partition is carved out of the Microsoft reserved partition
when the disk is converted from basic to dynamic, and what's left becomes a new Microsoft reserved partition).
6. Restart and boot with Windows Installation DVD, then enter the console (SHIFT+10).
7. DISKPART, SELECT the correct disk, you'll notice it is no longer considered a dynamic disk, but a basic GPT disk.
@rwasef1830
rwasef1830 / UpdateDnsIpAllZone.ps1
Created September 29, 2020 01:46
Update Windows DNS Server A record IPs in all Zones
param (
[Parameter(Mandatory=$true)][string] $oldIp,
[Parameter(Mandatory=$true)][string] $newIp)
$zones = Get-DnsServerZone
$zoneNames = $zones | Select-Object -Property ZoneName
ForEach ($zoneName in $zoneNames) {
$records = Get-DnsServerResourceRecord $zoneName.ZoneName -RRType "A"
ForEach ($record in $records) {
If ($record.RecordData.IPv4Address -eq $oldIp) {
@Echo Off
REM This file is replacement for the old WebMatrix / IIS Express / PHP stack
REM Put this file in %AppData%\Microsoft\Windows\SendTo
If NOT "%1"=="" cd /D "%2"
Echo Pulling latest image...
docker pull webdevops/php-apache-dev:7.4-alpine
Echo Pruning old images...
docker image prune -f
If exist .docker-dev-server for /F "usebackq tokens=1" %%i IN (`type .docker-dev-server`) Do SET LOCALPORT=%%i
#!/bin/sh
BAND=${1:?Specify BAND (eg: 1, 3, 5, 7, 28) or 0 to unlock}
if [ "$BAND" != "0" ]; then
FREQ=${2:?Specify DL Frequency x 10 (eg: 18484 for 1848.4 MHz)}
PCI=${3:?Specify tower PCI}
else
echo "./balong-nvtool -m 53810:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"
exit
fi
@rwasef1830
rwasef1830 / failover-service.sh
Created May 26, 2019 15:29
DD-WRT 4G WAN Failover Script
#!/bin/sh
INTERVAL=10
PACKETS=1
USINGWAN=0
WAN1=ppp0
WAN2=eth3
# We'll run this in the intervals given above
while sleep $INTERVAL
do
@rwasef1830
rwasef1830 / create_macos_installer_iso.sh
Created February 13, 2018 13:28
macOS 10.13.3 ISO creation script (run from mac as sudo after downloading High Sierra from Apple Store)
hdiutil create -o /tmp/HighSierra.cdr -size 5530m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build
mv /tmp/HighSierra.cdr.dmg ~/Desktop/InstallSystem.dmg
hdiutil detach /Volumes/Install\ macOS\ High\ Sierra
hdiutil convert ~/Desktop/InstallSystem.dmg -format UDTO -o ~/Desktop/HighSierra.iso
mv ~/Desktop/HighSierra.iso.cdr ~/Desktop/HighSierra.iso
rm ~/Desktop/InstallSystem.dmg
' Source: http://www.anchor.com.au/hosting/dedicated/monitoring_windows_software_raid
' Software RAID status check script
Option Explicit
Dim WshShell, oExec
Dim Line, RE0, RE1, RE2, RE3
Dim Failed
Failed = -1
#!/usr/bin/env python3
# This Nagios plugin may be used to check the health of an RDP server, such
# as a Windows host offering remote desktop. Typically, a "strange" RDP
# response is a good indication of a Windows host is having trouble (while
# it is still responding to ping).
# It seems that the RDP protocol is based on a protocol called X.224,
# and this plugin only goes as far as checking very basic X.224
# protocol operations. Hence, the somewhat strange name of the plugin.