Skip to content

Instantly share code, notes, and snippets.

View pomaxa's full-sized avatar
🦄
!

Romans Shvets pomaxa

🦄
!
  • 02:03 (UTC +03:00)
View GitHub Profile
@pomaxa
pomaxa / .scrutinizer.yml
Created September 2, 2021 18:19 — forked from yoanm/.scrutinizer.yml
Default scrutinizer configuration for a newly created PHP project
checks:
php:
code_rating: true
duplication: true
build_failure_conditions:
- 'project.metric_change("scrutinizer.quality", < -0.10)'
- 'elements.rating(<= D).exists' # No classes/methods with a rating of D or worse
- 'elements.rating(<= D).new.exists' # No new classes/methods with a rating of D or worse allowed
- 'issues.label("coding-style").exists' # No coding style issues allowed
awk
-F "FIELD DELIMITER"
/pattern/ to match
!/pattern/ to exclude
@pomaxa
pomaxa / git.config
Last active September 6, 2016 11:11
git.config
[user]
name = Author Name
email = author@email.com
[core]
autocrlf = input
excludesfile = ~/.gitignore
[diff]
tool = kdiff3
[alias]
logtree = log --graph --oneline --decorate --all
<?php
/*
* Copyright (c) 2014 Optimal Payments
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@pomaxa
pomaxa / remove-local-merged-branchs.sh
Created October 23, 2015 15:03
remove-local-merged-branchs.sh
#!/bin/bash
if test 0 -eq `git status | grep '# On branch master' | wc -l`
then
`git checkout master`
`git pull origin master`
fi;
echo 'Будут удалены все слитые в master ветки, которых нет в Origin';
echo 'Вы уверены? [Y/n]';
CREATE DEFINER=`root`@`localhost` FUNCTION `luhn_sum`(p_number VARCHAR(32)) RETURNS INT(11)
SQL SECURITY INVOKER
BEGIN
DECLARE i, mysum, r, weight INT;
SET weight = 1;
SET mysum = 0;
SET i = length(p_number);
WHILE i > 0 DO
@pomaxa
pomaxa / gist:e89cf8830e9151b03089
Created September 3, 2014 09:53
send request to client browser and proceed with some work.
ob_end_clean();
header("Connection: close");
ignore_user_abort(true);
ob_start();
echo "THIS IS SPARTA";
$size = ob_get_length();
header("Content-Length: $size");
ob_end_flush();
flush();
session_write_close();
@pomaxa
pomaxa / git terminal commands
Created September 1, 2014 09:32
pretty per author stats for git repository in one line.
git log --shortstat --pretty="%cE" | sed 's/\(.*\)@.*/\1/' | grep -v "^$" | awk 'BEGIN { line=""; } !/^ / { if (line=="" || !match(line, $0)) {line = $0 "," line }} /^ / { print line " # " $0; line=""}' | sort | sed -E 's/# //;s/ files? changed,//;s/([0-9]+) ([0-9]+ deletion)/\1 0 insertions\(+\), \2/;s/\(\+\)$/\(\+\), 0 deletions\(-\)/;s/insertions?\(\+\), //;s/ deletions?\(-\)//' | awk 'BEGIN {name=""; files=0; insertions=0; deletions=0;} {if ($1 != name &amp;&amp; name != "") { print name ": " files " files changed, " insertions " insertions(+), " deletions " deletions(-), " insertions-deletions " net"; files=0; insertions=0; deletions=0; name=$1; } name=$1; files+=$2; insertions+=$3; deletions+=$4} END {print name ": " files " files changed, " insertions " insertions(+), " deletions " deletions(-), " insertions-deletions " net";}'

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"