Skip to content

Instantly share code, notes, and snippets.

View leonlaser's full-sized avatar
🍪

Leon Dietsch leonlaser

🍪
View GitHub Profile
@leonlaser
leonlaser / ideolog_pattern.txt
Last active July 12, 2024 06:32
[logfmt regex] Split your logfmt logfile into key value pairs #golang #go #regex #regularexpression #logfmt #intellij #ideolog
Message pattern: ^time="(.*)" level=([^\s]+) .*$
Message start pattern: ^time=
Time format: yyyy-MM-dd'T'HH:mm:ssXXX
Time capture group: 1
Serverity capture group: 2
Reference: https://github.com/JetBrains/ideolog/wiki/Custom-Log-Formats
@leonlaser
leonlaser / phpmd.xml
Last active January 14, 2020 10:41 — forked from dimamix/phpmd.xml
phpmd.xml example
<?xml version="1.0"?>
<ruleset>
<description>Custom ruleset for Behance code standards</description>
<!-- Rues are imported individually to allow for easy configuration -->
<!-- Property names and values can be found here: http://phpmd.org/rules/index.html -->
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength">
<properties>
@leonlaser
leonlaser / replace_user_by_id
Created May 1, 2019 10:43
[Replace user by uid] #shell #unix #find #permission
#!/bin/sh
sudo find /usr/local -uid $oldUserId -exec chown $newUser {} +
@leonlaser
leonlaser / remove_dangling_images
Last active October 24, 2020 14:54
[Docker helper] Handling container and images #docker #bash #sh #terminal #console
#!/bin/sh
docker rmi -f $(docker images -f "dangling=true" -q)
@leonlaser
leonlaser / remove_past_tags
Last active April 1, 2019 14:10
[Delete git tags dont have $tag as an ancestor] #git #tags
comm -23 <(git tag | sort) <(git tag --contains $tag | sort) | xargs git push --delete origin
git fetch --prune origin '+refs/tags/*:refs/tags/*'
@leonlaser
leonlaser / new_ssh_key
Last active March 11, 2020 12:09
[Generate new SSH public/private key pair] #bash #ssh #key
#!/bin/bash
ssh-keygen -t ed25519 -o -a 100 -C "$identifier" -f ./id_rsa
@leonlaser
leonlaser / wait_forever
Last active March 26, 2019 09:56
[Bash wait forever] Test script for signaling a process to stop #bash #while #sleep #loop
#!/bin/bash
while :
do
echo "Press [CTRL+C] to stop.."
sleep 1
done
@leonlaser
leonlaser / seeyouspacecowboy.bash
Last active March 26, 2019 10:25
[Print colored "See you space cowboy" message] #bash #text #colored
#!/usr/bin/env bash
# SEE YOU SPACE COWBOY by DANIEL REHN (danielrehn.com)
# Displays a timeless message in your terminal with cosmic color effects
# Usage: add "sh ~/seeyouspacecowboy.sh; sleep 2" to .bash_logout (or similar) in your home directory
# (adjust the sleep variable to display the message for more seconds)
# Cosmic color sequence
@leonlaser
leonlaser / test_php_script
Last active March 22, 2019 10:51
[Test PHP script] A script to test scripts with a shebang
#!/usr/bin/env php
<?php
echo "><(((('>" . PHP_EOL;
@leonlaser
leonlaser / echo_flip_table.sh
Last active March 22, 2019 10:52
[Print ASCII Art Table Flip] #shell #asciiart #ascii #echo
#!/bin/sh
# source: https://cutekaomoji.com/misc/table-flipping/
echo "(╯°□°)╯︵ ┻━┻"