Skip to content

Instantly share code, notes, and snippets.

View gmelikov's full-sized avatar
:octocat:
Githubing

George Melikov gmelikov

:octocat:
Githubing
View GitHub Profile
@Kramerican
Kramerican / monitor-lxd-io.php
Last active January 29, 2023 20:47
Quick and dirty LXD container disk i/o monitoring on ZFS filesystems
View monitor-lxd-io.php
#DO NOT USE THIS SCRIPT - IT IS GARBAGE. USE NETDATA INSTEAD! IT WILL SOLVE ALL YOUR MONITORING NEEDS AND MORE! https://github.com/firehol/netdata
#!/usr//bin/php
<?php
/*
Quick and dirty command line utility to monitor disk IO for LXD containers
Accepts refresh interval as command line parameter
@brendangregg
brendangregg / fsmicrobench.md
Last active February 16, 2022 08:25
some FS micro-benchmarks
View fsmicrobench.md

F1. FS 128k streaming writes

Benchmark: fio write

Command: fio --name=seqwrite --rw=write --bs=128k --size=4g --end_fsync=1 --loops=4 # aggrb tput

Rationale: Measure the performance of a single threaded streaming write of a reasonably large file. The aim is to measure how well the file system and platform can sustain a write workload, which will depend on how well it can group and dispatch writes. It's difficult to benchmark buffered file system writes in both a short duration and in a repeatable way, as performance greatly depends on if and when the pagecache begins to flush dirty data. As a workaround, an fsync() at the end of the benchmark is called to ensure that flushing will always occur, and the benchmark also repeats four times. While this provides a much more reliable measurement, it is somewhat worst-case (applications don't always fsync), providing closer to a minimum rate – rather than a maximum rate – that you should expect.

F2. FS cached 4k random reads

@trevnorris
trevnorris / perf-flame-graph-notes.md
Last active June 15, 2023 21:44
Quick steps of how to create a flame graph using perf
View perf-flame-graph-notes.md

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
@colinux
colinux / subtitles-renamer.sh
Created January 27, 2011 23:21
Rename subtitles files according to tv shows names found in a directory
View subtitles-renamer.sh
#!/bin/bash
# Renames subtitles files according to tv shows names found in a directory
# Acceped syntaxes for season/episode are: 304, s3e04, s03e04, 3x04 (case insensitive)
#
# Usage:
# Put this gist somewhere in your $PATH, like /usr/local/bin/subtitles-renamer
# Chmod +x it
# cd ~/YourHolidaysTvShowsWithSubtitles
# subtitles-renamer