Skip to content

Instantly share code, notes, and snippets.

View stmswitcher's full-sized avatar

Denis Alexandrov stmswitcher

  • Hamburg, Germany
View GitHub Profile
@stmswitcher
stmswitcher / acces-log-parser.php
Created May 16, 2019 12:44
Most requested paths from web server access logs
#!/usr/bin/env php
<?php
$filename = $argv[1] ?? false;
if (!file_exists($filename)) {
echo "File not found" . PHP_EOL;
exit(1);
}
$results = [];
@stmswitcher
stmswitcher / tar-updated-git-files.sh
Last active July 30, 2016 10:20
Creates archive with updated git files
#!/bin/bash
git status | grep -E "^\s+(modified|new\sfile)" | sed -E "s/.+:\s+//" | tar -cvf test.tar -T - --no-recursion
@stmswitcher
stmswitcher / codecept.random.option.select.php
Last active February 11, 2023 05:40
Select random option for Codeception
$options = $I->grabMultiple('#selectID option', 'value');
$I->selectOption('select', $options[array_rand($options)]);
@stmswitcher
stmswitcher / zip.files.by.extension.sh
Created December 21, 2015 16:12
shell/bash zip multiple files specified by extension
#!/bin/bash
ls *.jpg *.png | zip -r archive.zip -@
@stmswitcher
stmswitcher / bash.randomly.rename.jpg.files.sh
Last active December 21, 2015 15:59 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash rename multiple jpg files with random strings
#!/bin/bash
#rename each file with generated lowercase random 16 character alphanumeric string
for i in *.jpg; do mv "$i" "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1).jpg"; done