Skip to content

Instantly share code, notes, and snippets.

View kolosek's full-sized avatar

Nebojsa Zoric kolosek

View GitHub Profile
@kolosek
kolosek / asterisk.sh
Last active March 13, 2024 15:20 — forked from linuxoracledev/asterisk.sh
Install Asterisk 16 LTS on Ubuntu 18.04 / 16.04 & Debian 10/9
#Update system & reboot
sudo apt update && sudo apt -y upgrade
sudo reboot
#Install Asterisk 16 LTS dependencies
sudo apt -y install git curl wget libnewt-dev libssl-dev libncurses5-dev subversion libsqlite3-dev build-essential libjansson-dev libxml2-dev uuid-dev
#Add universe repository and install subversio
sudo add-apt-repository universe
sudo apt update && sudo apt -y install subversion
@kolosek
kolosek / asterisk.sh
Created May 23, 2020 09:00 — forked from linuxoracledev/asterisk.sh
Install Asterisk 16 LTS on Ubuntu 18.04 / 16.04 & Debian 10/9
#Update system & reboot
sudo apt update && sudo apt -y upgrade
sudo reboot
#Install Asterisk 16 LTS dependencies
sudo apt -y install git curl wget libnewt-dev libssl-dev libncurses5-dev subversion libsqlite3-dev build-essential libjansson-dev libxml2-dev uuid-dev
#Add universe repository and install subversio
sudo add-apt-repository universe
sudo apt update && sudo apt -y install subversion
@kolosek
kolosek / rspec_model_testing_template.rb
Created March 26, 2020 09:23 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@kolosek
kolosek / private_fork.md
Created November 24, 2018 15:30 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@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
# 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 / hacker-processes-check.sh
Last active June 10, 2016 11:10 — forked from shaiguitar/gist:1032229
check processes with kill -0
usage()
{
echo "./$0 [--verbose]"
}
VERBOSE=0
if [ "$1" == "--verbose" ]; then
VERBOSE=1
fi
@kolosek
kolosek / spec_helper.rb
Last active September 18, 2015 12:59 — forked from ahamid/spec_helper.rb
benchmark + profile RSpec test
require 'ruby-prof'
require 'benchmark'
module BenchmarkHelpers
PROFILE_OUTPUT_DIR = "profiling"
def self.safe_filename(name)
name.gsub(" ", "_")
end
def self.example_output_target_file!(example)
# See http://m.onkey.org/running-rails-performance-tests-on-real-data
# START : HAX HAX HAX
# Load Rails environment in 'test' mode
RAILS_ENV = "test"
require File.expand_path('../../config/environment', __FILE__)
# Re-establish db connection for 'performance' mode
silence_warnings { RAILS_ENV = "performance" }
ActiveRecord::Base.establish_connection