Skip to content

Instantly share code, notes, and snippets.

View deoomen's full-sized avatar

deoomen deoomen

View GitHub Profile
@deoomen
deoomen / change_commits_author.sh
Created July 11, 2024 08:11
Change commits author
git filter-branch --env-filter '
OLD_EMAIL="old@email.com"
CORRECT_NAME="new_name"
CORRECT_EMAIL="new@email.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
@deoomen
deoomen / google-chat-notifier.sh
Last active January 31, 2024 11:32
Google Chat Webhook Notifier (with threads)
#!/bin/bash
set -euo pipefail
# Author: deoomen (https://github.com/deoomen)
# Inspired by: https://earlruby.org/2023/12/posting-to-google-spaces-from-bash/
# List of webhooks from Google Spaces.
declare -A CHANNELS
CHANNELS=(
["channel1"]="https://chat.googleapis.com/v1/spaces/...",
@deoomen
deoomen / releaser.sh
Last active February 2, 2022 14:07
This script helps you create releases for a GIT project by automating some actions - it also supports Conventional Commits.
#!/bin/bash
#
# █▀█ █▀▀ █ █▀▀ █▀█ █▀ █▀▀ █▀█
# █▀▄ ██▄ █▄▄ ██▄ █▀█ ▄█ ██▄ █▀▄
#
# Credits:
# - Author: deoomen (https://github.com/deoomen)
# - Inspired by: https://gist.github.com/jv-k/703e79306554c26a65a7cfdb9ca119c6
#
@deoomen
deoomen / phpmd.xml
Created February 11, 2021 07:52
PHP Mess Detector ruleset
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="phpmd"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>PHP Mess Detector ruleset by deoomen</description>
<rule ref="rulesets/codesize.xml"/>
<rule ref="rulesets/controversial.xml"/>
<rule ref="rulesets/design.xml"/>
@deoomen
deoomen / phpcs.xml
Last active February 11, 2021 07:50
PHP Code Sniffer ruleset
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="phpcs">
<description>PHP Code Sniffer ruleset by deoomen</description>
<rule ref="Generic.Classes.DuplicateClassName"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
@deoomen
deoomen / xdebug-php.ini
Created November 20, 2020 07:15
Xdebug config for php.ini
[xdebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.collect_assignments = 1
xdebug.collect_includes = 1
xdebug.collect_params = 1
xdebug.collect_return = 1
; xdebug.collect_vars = 1
xdebug.var_display_max_depth = 5
; xdebug.var_display_max_children = 256
@deoomen
deoomen / runbatinbg.vbs
Created August 17, 2020 15:37
Windows: run bat script in background
Set WshShell = WScript.CreateObject("WScript.Shell")
If WScript.Arguments.Length = 0 Then
Set ObjShell = CreateObject("Shell.Application")
ObjShell.ShellExecute "wscript.exe" _
, """" & WScript.ScriptFullName & """ RunAsAdministrator", , "runas", 1
WScript.Quit
End if
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.CurrentDirectory = "<bat_dir_path>"
@deoomen
deoomen / service_manager-1
Created August 17, 2020 15:33
Simple and fast manager of the most frequently used services written by me in bash
#!/bin/bash
function fun_serviceManage {
if [[ `pgrep -c $1` -ne "0" ]] ; then
echo -e "$2 \e[92mworking. \e[91mDisable\e[39m? [Y/n]: \c"
read -n 1 answer
echo ""
if [[ $answer = "Y" || $answer = "y" || $answer = "" ]] ; then
`sudo service $1 stop`
echo -e "$2 \e[91mdisabled\e[39m."
@deoomen
deoomen / service_manager-2
Last active August 17, 2020 15:33
Simple and fast manager of the most frequently used services written by me in bash
#!/bin/bash
clear
# define global vars
apacheStatus=""
buildMenu() {
# clear
printf "1. Apache is %s"