Skip to content

Instantly share code, notes, and snippets.

@pawcik
pawcik / .env
Created September 3, 2022 09:15
n8n + docker + postgresql + ssl
POSTGRES_USER=changeUser
POSTGRES_PASSWORD=changePassword
POSTGRES_DB=n8n
POSTGRES_NON_ROOT_USER=changeUser
POSTGRES_NON_ROOT_PASSWORD=changePassword
N8N_BASIC_AUTH_USER=changeN8nUser
N8N_BASIC_AUTH_PASSWORD=changeN8nPassword
@pawcik
pawcik / __set_gbr_abbr.fish
Created September 20, 2018 07:21
Set fish "bgr" abbreviations that expands to current git branch
function __set_gbr_abbr --on-variable PWD
# Check if we are in a git repository
if command git rev-parse --is-inside-work-tree >/dev/null 2>&1
set base_command "gbr=git commit --message \"#"
set branch (git symbolic-ref --short HEAD 2>/dev/null)
abbr gbr $branch
else
abbr -e gbr 2>/dev/null
end
end
@pawcik
pawcik / fish_git_prompt_diff_shortstat.fish
Last active April 23, 2018 01:58
Fish function to format and show git diff --shortstat in prompt
function fish_git_prompt_diff_shortstat
set -l changedLines (command git diff --shortstat --exit-code ^/dev/null)
if test $status -ne 0
set -l insertedLines (string match -r '(\d+) insertion' $changedLines)[2]
set -l deletedLines (string match -r '(\d+) deletion' $changedLines)[2]
set_color magenta
printf "+%d/-%d" "$insertedLines" "$deletedLines"
set_color normal
end
end
@pawcik
pawcik / prepare-commit-msg
Created August 24, 2017 16:18
Git hook: prepare-commit-msg. Prefix git commit message with ticket id.
#!/bin/sh
#
# Automatically adds jira id to commit message.
# The branch name must contains valid ticket prefix, eg. AT-[0-9]{1,}
#
# to support multiple projects edit $projects variable
projects="AT IT TEST GIT"
content="$(cat "$1")"
ticket=""
@pawcik
pawcik / hosts.sh
Created July 19, 2017 07:43 — forked from pawel-jedruch-miquido/hosts.sh
Fix OS X issue with localhost DNS Lookup (/etc/hosts)
hostname=$(scutil --get LocalHostName)
#Add this line to /etc/hosts/
echo "127.0.0.1 localhost ${hostname}.local" >> /etc/hosts
begin
for r in (select table_name, extension from user_stat_extensions where droppable = 'YES' and creator='USER' and table_name = 'TABLE_NAME') loop
dbms_stats.drop_extended_stats(user, r.table_name, r.extension);
end loop;
end;
/
@pawcik
pawcik / createTMBackupImage.sh
Last active May 5, 2017 21:28
Create sparsebundle timemachine image
# thanks to http://www.makeuseof.com/tag/turn-nas-windows-share-time-machine-backup/
#create sparce image size (prefer twice of mac local drive)
hdiutil create -size 1024g -type SPARSEBUNDLE -fs "HFS+J" TimeMachine.sparsebundle
#mount sparse bundle image
# how to make it persistent ?
hdiutil attach -mountpoint /Volumes/TimeMachine /Volumes/Data/TimeMachine.sparsebundle
# tell timemachine to use this image for backup
@pawcik
pawcik / ctrl-h-fix
Created November 14, 2016 09:01
Enable c-h in neovim
#replace c-h with \177 key - DEL ?
infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > $TERM.ti
# apply changes
tic $TERM.ti
@pawcik
pawcik / fix_cisco_any_docker.sh
Last active January 25, 2016 12:47
Resolve problem with accessing docker machine with cisco anyconnect VPN
#!/bin/bash
set -euo pipefail
#Thanks to https://github.com/boot2docker/boot2docker/issues/628#issuecomment-148961252
confirm () {
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case $response in
[yY][eE][sS]|[yY])
@pawcik
pawcik / testTimestamp.gradle
Created January 27, 2015 22:32
gradle test timestamp
import groovy.time.TimeCategory
test {
testLogging {
afterTest { TestDescriptor desc, TestResult res ->
def td = TimeCategory.minus(new Date(res.endTime), new Date(res.startTime))
println " $res.resultType ($td) $desc.name ($desc.className)"
}
}
}