Skip to content

Instantly share code, notes, and snippets.

View utamas's full-sized avatar

Tamas Utasi utamas

View GitHub Profile
@utamas
utamas / list-all-jira-codes.sh
Created January 1, 2016 19:27
Lists all jira ids (without prefix)
#!/bin/bash
current="$1"
pattern='JIRA-[0-9]+'
while [[ ${current} =~ (${pattern}) ]]; do
echo "${BASH_REMATCH[1]}"
current=${current##*${BASH_REMATCH[1]}}
done
@utamas
utamas / setup-firewall.sh
Created January 1, 2016 17:39
Sets up ubuntu firewall, dropping packages on ports that are not whitelisted.
setupFirewall() {
# Flushing firewall rules.
sudo iptables -F
# Enabling outgoing packets.
sudo iptables -P OUTPUT ACCEPT
sudo iptables -P INPUT DROP
sudo iptables -P FORWARD DROP
sudo iptables -A INPUT --in-interface lo -j ACCEPT
@utamas
utamas / set-hostname.sh
Created January 1, 2016 17:37
set-hostname
set-hostname() {
local hostname=$1
sudo hostname $hostname
echo "$hostname" | sudo tee /etc/hostname
echo "127.0.0.1 $hostname" | sudo tee -a /etc/hosts
}
@utamas
utamas / create-user.sh
Last active January 1, 2016 17:38
createUser
create-user() {
local username=$1
local password=$2
sudo useradd -p $(openssl passwd -1 $password) -c "$username" -m -s /bin/bash $username
}
fetchArchive() {
local host=$1
local token=$2
local projectId=$3
if [[ -z "$host" ]] || [[ -z "$token" ]] || [[ -z "$projectId" ]]; then
echo
echo "Usage: $FUNCNAME <host> <gitlab account token> <project id>"
echo
return 1
@utamas
utamas / install-env
Last active August 29, 2015 14:20
Install envornment
#!/bin/bash -e
################################################################################
# To use this script copy and paste the following line without the "#" character
# into a "git bash" - installed by msysgit (http://msysgit.github.io/)
################################################################################
# curl -sLo env-setup http://epa.ms/env-setup && source env-setup
################################################################################
host="https://git.epam.com"
if [ ! -z "$1" ] ; then
@utamas
utamas / setup-environment.sh
Last active August 29, 2015 14:20
Set up shell environment
#!/bin/bash -e
################################################################################
# To use this script copy and paste the following line without the "#" character
# into a "git bash" - installed by msysgit (http://msysgit.github.io/)
################################################################################
# curl -sLo env-setup http://epa.ms/env-setup && source env-setup
################################################################################
host="https://git.epam.com"
if [ ! -z "$1" ] ; then
@utamas
utamas / add-key.sh
Last active August 29, 2015 14:19
Add private key to your git account.
#!/bin/bash -e
################################################################################
# To use this script copy and paste the following line without the "#" character
# into a "git bash" - installed by msysgit (http://msysgit.github.io/)
################################################################################
# curl -sLo add-key.sh http://epa.ms/gitkey && chmod u+x add-key.sh && ./add-key.sh
################################################################################
url="https://git.epam.com"
if [ ! -z "$1" ] ; then