Skip to content

Instantly share code, notes, and snippets.

View demofly's full-sized avatar

Stanislav O. demofly

View GitHub Profile
@demofly
demofly / centos-install-monit-php-fpm.sh
Last active November 28, 2019 00:10
Script to setup Monit to autorestart a hanged php-fpm for CentOS
#!/bin/bash
yum -y install monit
chkconfig monit on
echo 'set daemon 10 # check services at 30 seconds intervals
set logfile syslog
set httpd port 2812 and
use address localhost # only accept connection from localhost
allow localhost # allow localhost to connect to the server and
@demofly
demofly / remove_crw.cmd
Created December 26, 2015 23:13 — forked from xvitaly/remove_crw.cmd
Remove telemetry updates for Windows 7 and 8.1
echo Uninstalling KB3075249 (telemetry for Win7/8.1)
start /w wusa.exe /uninstall /kb:3075249 /quiet /norestart
echo Uninstalling KB3080149 (telemetry for Win7/8.1)
start /w wusa.exe /uninstall /kb:3080149 /quiet /norestart
echo Uninstalling KB3021917 (telemetry for Win7)
start /w wusa.exe /uninstall /kb:3021917 /quiet /norestart
echo Uninstalling KB3022345 (telemetry)
start /w wusa.exe /uninstall /kb:3022345 /quiet /norestart
echo Uninstalling KB3068708 (telemetry)
start /w wusa.exe /uninstall /kb:3068708 /quiet /norestart
@demofly
demofly / db-field-diff.php
Created October 30, 2015 00:31
PHP script to find Diffs in field in a table
<?php
$db = 'DBname';
$localdb = mysql_connect('localhost', 'root', '');
$masterdb = mysql_connect('master', 'root', '');
mysql_select_db($db,$localdb);
mysql_select_db($db,$masterdb);
@demofly
demofly / convert_ploop_to_simfs.sh
Last active September 9, 2015 11:30 — forked from dlage/convert_ploop_to_simfs.sh
Bash script to convert an OpenVZ ploop container back to simfs
#!/bin/sh
# ./convert_ploop_to_simfs.sh VEID
# chmod +x convert_ploop_to_simfs.sh
rsync_options='-aHv'
partition='vz'
if [ ! -e /etc/vz/conf/$1.conf ]; then
echo "Virtual server configuration file: /etc/vz/conf/$1.conf does not exist."
exit 1
fi
if [ ! -d /$partition/private/$1/root.hdd ]; then
@demofly
demofly / lsi.sh
Last active February 21, 2022 14:40
MegaCli wrapper for LSI MegaRAID for Debian/Ubuntu/RHEL/CentOS
#!/bin/bash
#
# originally came from Calomel.org
# https://calomel.org/megacli_lsi_commands.html
# LSI MegaRaid CLI
# lsi.sh @ Version 0.05
# Edited and optimized by demofly for rotational RAID arrays
#
# description: MegaCLI script to configure an Sound alarm disabled (server room too loud anyways)d monitor LSI raid cards.
@demofly
demofly / phantomjs
Last active October 15, 2023 14:45
Phantomjs startup script for Centos
#!/bin/sh
#
# chkconfig: - 35 99 99
# description: phantomjs zombo launchery
#
### BEGIN INIT INFO
# Provides: phantomjs
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
@demofly
demofly / smb.conf
Created August 6, 2015 16:13
smb.conf for dev VMs in AD
[global]
workgroup = SAGL
server string = SA
netbios name = duser047
hosts allow = 10.8. 127.0.0.1
log file = /var/log/samba/log.%m
max log size = 50
@demofly
demofly / HostDime-slowBRsorted.log
Created July 16, 2015 10:50
HostDime latency for 1x1 pixel, Brazil only, one day selection
==== Peaks:
0.226 "\xC1guas Belas"
0.030 "Xanxer\xEA"
0.010 "Votorantim"
0.123 "Vit\xF3ria"
0.023 "Vila Velha"
0.025 "Ven\xE2ncio Aires"
0.022 "Vanini"
0.023 "Valinhos"
0.045 "Uberl\xE2ndia"
@demofly
demofly / set_irq_affinity.sh
Last active April 3, 2017 09:08 — forked from pavel-odintsov/irq_balance_habrahabr.sh
IRQ CPU affinity setter: network and RAID hardware
#!/bin/bash
ncpus=`grep -ciw ^processor /proc/cpuinfo`
test "$ncpus" -gt 1 || exit 1
n=0
for irq in `cat /proc/interrupts | grep 'IR-PCI-MSI-edge' | awk '{print $1}' | sed s/\://g`
do
f="/proc/irq/$irq/smp_affinity"
test -r "$f" || continue
@demofly
demofly / php-debug-logger.php
Created May 8, 2015 12:07
The simplest php debug logger
<?php
file_put_contents( "/tmp/php-debug.log", strtotime("now")." $message\n", FILE_APPEND);
?>