Skip to content

Instantly share code, notes, and snippets.

View freimanas's full-sized avatar

Vladas Freimanas freimanas

  • Plus Telecom Ltd
  • United Kingdom
View GitHub Profile
@freimanas
freimanas / post-merge
Created December 23, 2015 12:47 — 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/`.
#/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 November 18, 2015 23:46
remove file from git without locally deleting it
#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
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 November 18, 2015 09:20
PHP nano highlight /usr/share/nano/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 November 15, 2015 14:28
find out AWS instances public IP
wget -qO- http://instance-data/latest/meta-data/public-ipv4
@freimanas
freimanas / gist:14c601ccde5c7a159070
Created November 15, 2015 14:10
A colour prompt for git branches on Ubuntu
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 March 29, 2022 22:37
Get twitter user's photo url's from tweets - download all images from twitter user
#!/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 = ""