Skip to content

Instantly share code, notes, and snippets.

View felipekm's full-sized avatar
🦈

Felipe Kautzmann felipekm

🦈
View GitHub Profile
@felipekm
felipekm / benchmark.sh
Last active April 10, 2018 14:05
Test-load the server with 200 concurrent connections for 10 seconds.
ab -c200 -t10 http://localhost:8080/
@felipekm
felipekm / revert.sh
Created April 10, 2018 23:43
GIT - how to revert to specific commit
git revert --no-commit {SHA_COMMIT}..HEAD && git add --all && git commit -m "revert"
@felipekm
felipekm / mysql_osx.md
Created April 12, 2018 16:13
How to START|STOP mysql server in OSX

Start MySQL

sudo /usr/local/mysql/support-files/mysql.server start

Stop MySQL

sudo /usr/local/mysql/support-files/mysql.server stop

Restart MySQL

sudo /usr/local/mysql/support-files/mysql.server restart

@felipekm
felipekm / revert.sh
Created June 11, 2018 19:06
Git - revert to specific commit
# Resets index to former commit; replace '56e05fced' with your commit code
git reset 56e05fced
# Moves pointer back to previous HEAD
git reset --soft HEAD@{1}
git commit -m "Revert to 56e05fced"
# Updates working copy to reflect the new commit
git reset --hard
@felipekm
felipekm / format_json_python.sh
Created June 12, 2018 13:22
Format JSON with python
#!bin/sh
echo '{"ae": 1}' | python -m json.tool
@felipekm
felipekm / grok_messageid_postfix.md
Last active June 25, 2018 22:51
Grok pattern to filter any kind of MessageID from postfix/cleanup logs

Grok filter matcher:

filter {
      if [program] =~ /^postfix.*\/cleanup.*/ {
         grok {
           patterns_dir => ["/etc/logstash/patterns"]
           match => { message => "%{SYSLOGBASE} %{QUEUEID:qid}: %{POSTFIX_WARNING_LEVEL: level}: header Message-%{MESSAGE_ID_HEADER:id}: (\W\s<)?(<)?%{GREEDYDATA:messageId}> from (%{RELAY}); from=<%{EMAILADDRESS:from}>(\sto=<%{EMAILADDRESS:to}>)?"}
           named_captures_only => false
           add_tag => ["_match_successfull", "grokked"]
@felipekm
felipekm / grok-patterns
Created August 24, 2018 12:55
Logstash Grok Patterns
USERNAME [a-zA-Z0-9._-]+
USER %{USERNAME}
INT (?:[+-]?(?:[0-9]+))
BASE10NUM (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))
NUMBER (?:%{BASE10NUM})
BASE16NUM (?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))
BASE16FLOAT \b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b
POSINT \b(?:[1-9][0-9]*)\b
NONNEGINT \b(?:[0-9]+)\b
@felipekm
felipekm / kill_node.sh
Last active September 19, 2018 19:43
Remove NVM, NODE, NPM completely
# RM ALL WHICH OUTS with rm
which npm
which node
whoch nvm
# Clean usr
sudo rm -rf /usr/bin/node
sudo rm -rf /usr/bin/npm
# Clean path
@felipekm
felipekm / felipekm.zsh-theme
Last active September 30, 2018 01:53
My ZSH Theme
#!/usr/bin/env zsh
#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
setopt promptsubst
autoload -U add-zsh-hook
PROMPT_SUCCESS_COLOR=$FG[117]
PROMPT_FAILURE_COLOR=$FG[124]
PROMPT_VCS_INFO_COLOR=$FG[242]
@felipekm
felipekm / do_ssh.md
Created November 19, 2018 15:54
Digital Ocean ssh access permission
  • Log as as a root to you Ubuntu server
  • vi /etc/ssh/sshd_config

Now go to very bottom: PasswordAuthentication from "no" to "yes".

Type: service sshd reload