Skip to content

Instantly share code, notes, and snippets.

View vertexvaar's full-sized avatar

Oliver Eglseder vertexvaar

View GitHub Profile
@vertexvaar
vertexvaar / log_process.sh
Created June 5, 2025 16:26
Process log file into ordered and counted list of entries
# Remove the leading 38 characters (`[05-Jun-2025 02:02:18 Europe/Berlin] `)
cat /var/log/php/php-fpm-web.log | cut -b 38- > php_1.log
# Remove the realpath web root portion which changes with each deployment
cat php_1.log | sed 's|/var/www/deployed/releases/[0-9]*||' > php_2.log
# sort first, so uniq reduces all eqal subsequent lines to one, add a counter for each reduced line and sort by the counter
cat php_2.log | sort | uniq -c | sort -bgr > php_3.log
# show the list of errors, ordered by number of times logged
https://askubuntu.com/a/1230834
It was happening because Ubuntu turned on the sound card power-saving capabilities. Turning it off can be the only way to get rid of the annoying sound:
Verify how is your sound card's power_save parameter:
cat /sys/module/snd_hda_intel/parameters/power_save
If it returns 1, do the following to change it temporally:
echo "0" | sudo tee /sys/module/snd_hda_intel/parameters/power_save
@vertexvaar
vertexvaar / Test.html
Last active January 9, 2024 12:45
Backtracing ViewHelper
<html data-namespace-typo3-fluid="true"
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:n="http://typo3.org/ns/CoStack/NextConf/ViewHelpers"
>
<n:touched>
<h1>Here it goes</h1>
<n:touch/>
<n:touched>
<h2>Not rendered</h2>
@vertexvaar
vertexvaar / FrontendTest.php
Last active November 25, 2023 18:20
vxvr.de parallel browser tests in Chrome and Firefox with co-stack/stack-test
<?php
declare(strict_types=1);
namespace App\Tests\Acceptance;
use CoStack\StackTest\BrowserTestCase;
use CoStack\StackTest\Factory\SessionFactory;
use CoStack\StackTest\Session;
use DateTimeImmutable;
@vertexvaar
vertexvaar / k8s.sh
Created September 1, 2022 09:40
kubectl helper
# Delete all failed pods
kubectl delete pods -A --field-selector=status.phase=Failed
@vertexvaar
vertexvaar / check-devices-online.sh
Created May 6, 2022 06:54
Check if machine is connected to the internet
#!/bin/bash
# Taken from https://stackoverflow.com/a/44280885/2025722
# Added more devices (mainly from docker) to excluded list
find /sys/class/net/ -maxdepth 1 -mindepth 1 ! -name "*lo*" ! -name "veth*" ! -name "br-*" ! -name "docker*" -exec sh -c 'cat "$0"/carrier 2>&1' {} \; | grep -q '1'
@vertexvaar
vertexvaar / debounce.js
Created February 3, 2022 17:59
Debounce JS
const centreElement = function () {
console.log('Debounced');
}
const echoStuff = function () {
console.log('Stuff');
}
const createDebounce = function (fnc, delayMs) {
var timeout = null;
@vertexvaar
vertexvaar / fpsCounter.js
Created February 3, 2022 17:45
Count Browser Window Framerate with JavaScript
let previousTimeStamp = null, frames = 0;
function counter(timestamp) {
if (previousTimeStamp == null) {
previousTimeStamp = parseInt(timestamp / 1000);
}
frames = frames + 1;
const sec = parseInt(timestamp / 1000);
if (sec !== previousTimeStamp) {
previousTimeStamp = sec;
@vertexvaar
vertexvaar / _info.md
Last active January 20, 2022 09:55
Dual Web Setup

Project Structure

app/local <- contains a full TYPO3 project (and a composer.json)
app/foreign <- contains a full TYPO3 project (and a composer.json)
packages/ <- contains multiple repositories
app/tests <- codeception acceptance tests which test the interaction between multiple repositories.

repos from packages are installed via composer in both "local" and "foreign" TYPO3 instances.
Both composer.jsons has a repositories section with type path and url /packages/*

@vertexvaar
vertexvaar / aa_andreas.php
Last active December 9, 2021 10:24
Challenge: Find arrays by array
<?php
return [
'array_array_array_array' => static fn ($array, $search) => array_values(array_filter($array, static fn($item) => empty(array_diff_assoc($search, array_intersect_assoc($item, $search))))),
'array_array_array_array_keys' => static fn ($array, $search) => array_values(array_filter($array, static fn($item) => empty(array_diff_key($search, array_intersect_assoc($item, $search))))),
'array_array_array' => static fn ($array, $search) => array_values(array_filter($array, static fn($item) => array_intersect_assoc($item, $search) === $search)),
'array_array_array_long' => static function ($array, $search) {
$results = [];
$c = count($array);