Skip to content

Instantly share code, notes, and snippets.

View marek-pietrzak-tg's full-sized avatar

Marek Pietrzak marek-pietrzak-tg

View GitHub Profile
@marek-pietrzak-tg
marek-pietrzak-tg / .zshrc
Created November 9, 2022 07:17 — forked from bmhatfield/.zshrc
OSX Keychain Environment Variables
# If you use bash, this technique isn't really zsh specific. Adapt as needed.
source ~/keychain-environment-variables.sh
# AWS configuration example, after doing:
# $ set-keychain-environment-variable AWS_ACCESS_KEY_ID
# provide: "AKIAYOURACCESSKEY"
# $ set-keychain-environment-variable AWS_SECRET_ACCESS_KEY
# provide: "j1/yoursupersecret/password"
export AWS_ACCESS_KEY_ID=$(keychain-environment-variable AWS_ACCESS_KEY_ID);
export AWS_SECRET_ACCESS_KEY=$(keychain-environment-variable AWS_SECRET_ACCESS_KEY);
@marek-pietrzak-tg
marek-pietrzak-tg / remove_merged_git_branches.sh
Created August 4, 2022 09:39
Remove merged git branches locally
git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
@marek-pietrzak-tg
marek-pietrzak-tg / convert.sh
Created September 25, 2019 07:44
Convert wav to mp3 from command line
# just copy and paste below command to the folder with wav files:
for f in *.wav; do lame --vbr-new -V 3 "$f" "${f%.wav}.mp3"; done

Keybase proof

I hereby claim:

  • I am mheki on github.
  • I am mheki (https://keybase.io/mheki) on keybase.
  • I have a public key ASDA4zySuEktwRMwmHiZ_cWyZF-Dq3Q5poC71bjUZ4_Yzgo

To claim this, I am signing this object:

@marek-pietrzak-tg
marek-pietrzak-tg / switch-php.sh
Created March 5, 2018 09:25
Switch PHP version on Ubuntu
#!/bin/bash
PHP_VERSION=$1
allowed_versions=(7.0 7.1 7.2)
is_allowed=$(printf ",%s" "${allowed_versions[@]}" | grep "$PHP_VERSION" | wc -l)
if [[ "$is_allowed" == "0" ]] ; then
echo "Allowed versions: ${allowed_versions[@]}"
exit 1
fi
@marek-pietrzak-tg
marek-pietrzak-tg / .bashrc
Created November 20, 2017 08:54
Show git branches in bash prompt
# show git branch on prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
@marek-pietrzak-tg
marek-pietrzak-tg / php7-alias.sh
Created October 18, 2017 07:04
Run php from docker (use it if you want to experiment with different php versions on the same machine)
alias php7='docker run -it --rm -v "$(pwd)":/tmp -w /tmp php php:7.1'
@marek-pietrzak-tg
marek-pietrzak-tg / ConsoleApplicationFactory.php
Created October 5, 2017 12:08
Service Manager aware Symfony Console in Zend Framework app
<?php
namespace Acme\Factory;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
use Symfony\Component\Console\Application;
class ConsoleApplicationFactory implements FactoryInterface
{
const APP_NAME = 'Acme';
git branch --merged | egrep -v '(^\*|master|uat)' | xargs git branch -d