Skip to content

Instantly share code, notes, and snippets.

Vladas Freimanas freimanas

  • Plus Telecom Ltd
  • United Kingdom
View GitHub Profile
@freimanas
freimanas / post-merge
Created Dec 23, 2015 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed. In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed. Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
View post-merge
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@freimanas
freimanas / gist:f34ca888e725c2c90427
Created Nov 18, 2015
remove file from git without locally deleting it
View gist:f34ca888e725c2c90427
#for this example it will be .idea
echo '.idea' >> .gitignore
git rm -r --cached .idea
git add .gitignore
git commit -m '(some message stating you added .idea to ignored entries)'
git push
View git_aliases.txt
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.hist 'log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
git config --global alias.type 'cat-file -t'
git config --global alias.dump 'cat-file -p'
@freimanas
freimanas / php.nanorc
Created Nov 18, 2015
PHP nano highlight /usr/share/nano/php.nanorc
View php.nanorc
syntax "php" "\.php|\.inc$"
color white start="<\?(php)?" end="\?>"
color magenta start="<[^\?]" end="[^\?]>"
color magenta "\$[a-zA-Z_0-9]*"
color brightblue "\->[a-zA-Z_0-9]*"
color cyan "(\[)|(\])"
color brightyellow "(var|class|function|echo|case|break|default|exit|switch|if|else|elseif|@|while|return|public|private|proteted|static)\s"
color brightyellow "\<(try|throw|catch|operator|new)\>"
color white "="
color green "[,{}()]"
@freimanas
freimanas / gist:54c36b78dff964b4cc4e
Created Nov 15, 2015
find out AWS instances public IP
View gist:54c36b78dff964b4cc4e
wget -qO- http://instance-data/latest/meta-data/public-ipv4
@freimanas
freimanas / gist:14c601ccde5c7a159070
Created Nov 15, 2015
A colour prompt for git branches on Ubuntu
View gist:14c601ccde5c7a159070
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NO_COLOR="\[\033[0m\]"
PS1="$GREEN\u@\h$NO_COLOR:\w$YELLOW\$(parse_git_branch)$NO_COLOR\$ "
@freimanas
freimanas / tweet_image_dumper.py
Last active Mar 21, 2019
Get twitter user's photo url's from tweets - download all images from twitter user
View tweet_image_dumper.py
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
import sys
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
You can’t perform that action at this time.