Skip to content

Instantly share code, notes, and snippets.

@jazzl0ver
jazzl0ver / test_disk.sh
Created May 12, 2022 — forked from kvaps/test_disk.sh
Test disk with fio and parse results
View test_disk.sh
#!/bin/sh
run(){
name="$1"
shift
(
set -x
# defailt parameters
fio -name="$name" -filename=$disk -output-format=json -ioengine=libaio -direct=1 -randrepeat=0 "$@" > results/$disk_dashed-$name.json
)
@jazzl0ver
jazzl0ver / move_attachments.php.patch
Created Sep 8, 2020
A dirty hack to move MantisBT attachments to disk by 100 at a time. Might be needed to execute it several times. Useful when there're a lot of attachments out there. Don't forget to raise max_execution_time and memory_limit PHP parameters in php.ini.
View move_attachments.php.patch
--- mantisbt-1.3.20/admin/move_attachments.php.orig 2019-09-26 19:42:19.000000000 +0300
+++ mantisbt-1.3.20/admin/move_attachments.php 2020-09-08 15:43:06.000000000 +0300
@@ -175,8 +175,13 @@
# Process projects list
foreach( $p_projects as $t_project ) {
+
+ $start = 0;
+ while ($start <= 1500) {
+ error_log($start);
@jazzl0ver
jazzl0ver / replicate_bucket.py
Created Aug 20, 2020
Replicate objects within or between regions in Oracle Cloud Object Storage
View replicate_bucket.py
#!/usr/bin/env python
#
# The script requires that the OCI CLI be installed
#
#
# Edit these values to configure the script
#
oci_cli_profile_name = 'DEFAULT'
@jazzl0ver
jazzl0ver / ad_backup.bat
Created Mar 25, 2020
Backup Windows SystemState along with custom folders to a shared storage
View ad_backup.bat
@echo off
rem -- put this script into the task scheduler and redirect output to a log file:
rem -- c:\utils\ad_backup.bat > c:\utils\ad_backup.log 2>&1
rem -- path to remote storage
set SHARE=\\filer-1\sysstates
rem -- what to backup
set PATH2BACKUP=c:\utils C:\Windows\System32\dns\backup
@jazzl0ver
jazzl0ver / freeradius_users_csv_to_xml.pl
Created Nov 13, 2019
Replace freeradius users in pfSense configuration file with the supplied CSV file
View freeradius_users_csv_to_xml.pl
#!/usr/bin/perl
#
# Script takes pfSense configuration file (1st argument), strips out all freeradius users
# and replaces them with the users from the CSV file (2nd argument):
# ./freeradius_users_csv_to_xml.pl pfSense-config.xml users.csv > pfSense-config-new.xml
#
# After the config uploaded and pfSense rebooted, https://gist.github.com/jazzl0ver/b605b1b6fc1effa448fa55467797ac81 patch should be applied:
#
# cd /root; patch -p0 < freeradius.inc.patch
#
@jazzl0ver
jazzl0ver / howto-gfs2-proxmox6.txt
Last active Dec 28, 2021
Setup GFS2 shared storage in Proxmox VE 6 on top of iSCSI LUN
View howto-gfs2-proxmox6.txt
#-- there're four proxmox boxes (vm-box-1..vm-box-4)
#-- all commands should be issued on one of the boxes
for i in $(seq 1 4); do ssh vm-box-$i apt install dlm-controld gfs2-utils -y; done
for i in $(seq 1 4); do ssh vm-box-$i 'echo DLM_CONTROLD_OPTS="--enable_fencing 0" >> /etc/default/dlm; systemctl restart dlm'; done
#-- check if /dev/misc folder exists. if not, run:
for i in $(seq 1 4); do ssh vm-box-$i "systemctl stop dlm; rmmod gfs2; rmmod dlm; sleep 3; systemctl restart udev; sleep 3; systemctl start dlm"; done
#-- add iscsi storage to proxmox (check shared)
@jazzl0ver
jazzl0ver / LayoutModification.xml
Last active Jun 25, 2020
Default Start menu and Taskbar layouts for Windows 10 and Server 2016+. Copy to C:\Users\Default\AppData\Local\Microsoft\Windows\Shell or enable via Group Policy (User Configuration > Administrative Templates > Start Menu and Taskbar -> Start Layout)
View LayoutModification.xml
<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification" Version="1">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6">
<start:Group Name="Windows Server">
<start:DesktopApplicationTile Size="2x2" Column="4" Row="0" DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell ISE.lnk" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="2" DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\Control Panel.lnk" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="4" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsof
@jazzl0ver
jazzl0ver / del_sqs_endp_from_sns.py
Created Jul 19, 2019
Unsubscribe SNS topic from deleted SQS endpoints
View del_sqs_endp_from_sns.py
#!/usr/bin/env python
#
# Unsubscribe SNS topic from deleted SQS endpoints
# One might want to run like this:
# for i in $(aws sns list-topics --output text | grep s3vol | cut -f2); do ./del_sqs_endp_from_sns.py $i; done
#
# Why: at this moment (July 2019) AWS does not support automatic SQS endpoint unsubscribing when the correspondence queue is deleted
#
import boto
View WsusDBMaintenance.sql
/******************************************************************************
This sample T-SQL script performs basic maintenance tasks on SUSDB
1. Identifies indexes that are fragmented and defragments them. For certain
tables, a fill-factor is set in order to improve insert performance.
Based on MSDN sample at http://msdn2.microsoft.com/en-us/library/ms188917.aspx
and tailored for SUSDB requirements
2. Updates potentially out-of-date table statistics.
3. Fixed line 100 by jazzl0ver (from https://stackoverflow.com/questions/12674664/alter-index-failed-because-of-quoted-identifier-when-running-from-sp-msforeachta)
******************************************************************************/
@jazzl0ver
jazzl0ver / freeradius.inc.patch
Created Jun 27, 2019
Fixes ldap authorization in pfSense 2.4.4-p3
View freeradius.inc.patch
--- /usr/local/pkg/freeradius.inc.orig 2019-06-27 12:05:51.627738000 +0000
+++ /usr/local/pkg/freeradius.inc 2019-06-27 12:09:45.938947000 +0000
@@ -1895,6 +1895,10 @@
{$varmodulesldap2enableauthorize}
}
+ update control {
+ Auth-Type := LDAP
+ }
+