Skip to content

Instantly share code, notes, and snippets.

View kolosek's full-sized avatar

Nebojsa Zoric kolosek

View GitHub Profile
# sets the proxy cache path location, max size 2g
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g;
# transfers the `Host` header to the backend
proxy_set_header Host $host;
# uses the defined STATIC cache zone
proxy_cache STATIC;
# cache 200 10 minutes, 404 1 minute, others status codes not cached
@kolosek
kolosek / phantomjs201.sh
Created January 19, 2017 14:05
install-phantomjs-codeship
#!/bin/bash
# Install a custom version 2 of PhantomJS, http://phantomjs.org/
#
# Include in your builds via
# \curl -sSL https://gist.githubusercontent.com/mlocher/f0f731dfa93c82d0fa86/raw/phantomjs2.sh | bash -s
PHANTOMJS_URL="https://s3.amazonaws.com/codeship.io/checkbot/binaries/phantomjs_2.0.1"
CACHED_DOWNLOAD="${HOME}/cache/phantomjs_2.0.1"
# official packages are now available, thus print an info message
echo -e "\e[36mOfficial PhantomJS 2 packages are now available from phantomjs.org\e[39m"
#!/bin/bash
# Install a custom version of PhantomJS, http://phantomjs.org/
#
# If you run into any rate limiting issues from bitbucket, put the download
# file(s) into your own server and point to the location via the PHANTOMJS_HOST
# environment variable.
#
# Add at least the following environment variables to your project configuration
# (otherwise the defaults below will be used).
# * PHANTOMJS_VERSION - Specify the version of PhantomJS
@kolosek
kolosek / rails-linux-install-1404.sh
Last active June 6, 2017 21:39
RVM Mysql Posgres Linux automated script
echo "Updates packages. Asks for your password."
sudo apt-get update -y
echo "Installs packages. Give your password when asked."
sudo apt-get install -y curl nodejs libcurl4-gnutls-dev git-core libxslt1-dev libxml2-dev libsqlite3-dev libgmp-dev libmysqlclient-dev git git-doc libncurses5-dev build-essential rake libqt4-dev libqtwebkit-dev openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config libv8-dev libmagickwand-dev libreadline-dev libedit-dev libgdbm-dev libffi-dev zlib1g-dev rake curl vim libgmp3-dev
echo "Setting up mysql"
sudo apt-get install -y mysql-server mysql-client
echo "Setting up postgres"
sudo -i
cd
apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xzvf ImageMagick.tar.gz
cd ImageMagick-7.0.6-0/
./configure --prefix=/opt/imagemagick-7.0 && make
checkinstall
@kolosek
kolosek / no_animations.rb
Created September 3, 2017 20:43 — forked from keithtom/no_animations.rb
Rack Middleware to disable Disable CSS3/jQuery Animations for Capybara
module Rack
# disable CSS3 and jQuery animations in test mode for speed, consistency and avoiding timing issues.
# Usage for Rails:
# in config/environments/test.rb
# config.middleware.use Rack::NoAnimations
class NoAnimations
def initialize(app, options = {})
@app = app
end
@kolosek
kolosek / country_code_mapper.rb
Created September 15, 2017 07:58
Mapping country code with country names
module PagesHelper
# Marker '#c' implies that character set has been updated on certain countries
def country_code
[["AFG", "Afghanistan"],
["ALB", "Albania"],
["DZA","Algeria"],
["ASM","American Samoa"],
["AND","Andorra"],
["AGO","Angola"],
["AIA","Anguilla"],
@kolosek
kolosek / rails-install-ubuntu-1604.sh
Last active October 21, 2017 09:51
Latest rails installation script for Ubuntu 16.04
echo "Updates packages. Asks for your password."
sudo apt-get update -y
echo "Installs packages. Give your password when asked."
sudo apt-get install -y curl nodejs libcurl4-gnutls-dev git-core libxslt1-dev libxml2-dev libsqlite3-dev libgmp-dev libmysqlclient-dev git git-doc libncurses5-dev build-essential rake libqt4-dev libqtwebkit-dev openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config libv8-dev libmagickwand-dev libreadline-dev libedit-dev libgdbm-dev libffi-dev zlib1g-dev rake curl vim libgmp3-dev phantomjs imagemagick
echo "Setting up mysql"
sudo apt-get install -y mysql-server mysql-client
echo "Setting up postgres"
@kolosek
kolosek / gitlabci-cleanup.sh
Created September 14, 2018 08:55
Cleanup old builds of gitlab
#!/bin/bash
# cleanup_gitlab_builds: to remove old gitlab builds
WORK_DIR=/home/gitlab-runner/builds
LAST_MODIFY_DAYS=30 # no of days the directory was modified
dir_array=()
space_cleared=0
skipped_dirs=()
QUIET=1