Skip to content

Instantly share code, notes, and snippets.

View kolosek's full-sized avatar

Nebojsa Zoric kolosek

View GitHub Profile
@kolosek
kolosek / ruby-install.sh
Last active December 13, 2022 09:07
Install aadf on fresh ubuntu installation, tested on ubuntu 22.04
sudo apt install make gcc dirmngr gpg curl gawk zlib1g-dev libssl-dev unzip
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
tar zxvf openssl-1.1.1g.tar.gz
cd openssl-1.1.1g/
./config --prefix=$HOME/.openssl/openssl-1.1.1g --openssldir=$HOME/.openssl/openssl-1.1.1g
make install
rm -rf ~/.openssl/openssl-1.1.1g/certs
ln -s /etc/ssl/certs ~/.openssl/openssl-1.1.1g/certs
#ASDF ruby manager
curl -so wazuh-agent-4.3.10.deb https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_4.3.10-1_amd64.deb && sudo WAZUH_MANAGER='wazuh.kolosek.dev' MANAGER_IP='wazuh.kolosek.dev' dpkg -i ./wazuh-agent-4.3.10.deb
sudo systemctl daemon-reload
sudo systemctl enable wazuh-agent
sudo systemctl start wazuh-agent
#!/bin/bash
#Preuzimanje i instalacija dependency-a
echo "Preuzimanje i instalacija dependency-a..."
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y curl git-core gdebi-core gdebi rar unrar gnupg2 vim qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x build-essential libssl-dev libreadline-dev libyaml-dev libxslt1-dev software-properties-common libcurl4 libcurl4-openssl-dev libcurl3-dev
#Instalacija imagemagick
echo "Preuzimanje i instalacija imagemagick..."
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y imagemagick libmagickcore-dev libmagickwand-dev
# Programming Principles
Every programmer benefits from understanding programming principles and patterns. This overview is a reference for myself, and I've just put it here. Maybe it is of help to you during design, discussion, or review. Please note that it's far from complete, and that you often need to make trade-offs between conflicting principles.
The list was inspired by [The Principles of Good Programming](http://www.artima.com/weblogs/viewpost.jsp?thread=331531). I felt that the list closely, but not completely matches what I would personally put into something similar. Additionally, I wanted a bit more reasoning, details, and links to further resources. [Let me know](https://github.com/webpro/programming-principles/issues) if you have any feedback or suggestions for improvement.
## Contents
### Generic
#!/bin/bash
echo 'This script will set up your Ubuntu 18.04 for Rails development.'
echo 'Press ENTER to continue with installation, press ^C to cancel.'
read
# Install required software
echo "------Installing requirements------"
sudo apt install -y curl git-core gdebi-core gdebi rar unrar gnupg2 vim
@kolosek
kolosek / gitlab-runner.sh
Last active January 25, 2022 21:48
Install docker and runner on bare bone Linux 18.04.1 machine
#chmod +x gitlab-runners.sh
#Set memory allocation for each runner.
sudo sysctl -w vm.max_map_count=262144
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
sudo apt install docker-ce
@kolosek
kolosek / ubuntu-1804-basic-rails.sh
Last active January 15, 2022 18:37
Basic installation of rails under ubuntu 18.04
#!/bin/bash
echo 'This script will set up your Ubuntu 18.04 for Rails development.'
echo 'Make sure you run our Basic Library installation at https://gist.github.com/kolosek/6ee0a6f9ffe374e7a1d6ff04143cd203'
echo 'Press ENTER to continue with installation, press ^C to cancel.'
# libssl1.0-dev
read
# Install RVM
echo "------Installing rvm------"
sudo apt install -y curl gnupg2
echo "Requires JAVA installation"
read
sudo apt-get purge elasticsearch
sudo su -c "echo 'deb https://artifacts.elastic.co/packages/6.x/apt stable main'>> /etc/apt/sources.list.d/elastic-6.x.list"
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get update
sudo apt-get install elasticsearch
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service
Ruby older than 2.4 relies on OpenSSL libary version 1.0
Ruby from version 2.4 relies on OpenSSL library version 1.1
Newer ubuntu 20.04 comes with openssl-dev1.1 pre-installed. And installing older version of Ruby is not possible, since you have 1.1 version of Openssl.
I am sure you see a conflict there. Solution to this problem is to remove open ssl from Ubuntu:
sudo apt purge openssl-dev
And install ruby version via RVM. But you need to add PPA so RVM can find older openssl.
@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: