Skip to content

Instantly share code, notes, and snippets.

View trajakovic's full-sized avatar

Tomislav trajakovic

  • Score Alarm
  • Zagreb
View GitHub Profile
@trajakovic
trajakovic / compile-elixir-v1.6.3.sh
Last active March 10, 2018 18:33
Compile and install Erlang 20.2 from source on Ubuntu 16.04 (Xenial Xerus or Linux Mint Sylvia 18.3). Compile and install Elixir 1.6.3 on Ubuntu 16.04
# requirement: erlang, git
ELIXIR_VERSION="1.6.3"
sudo apt-get update && sudo apt-get install -y git && \
rm -rf /tmp/code/elixir/${ELIXIR_VERSION} && mkdir -p /tmp/code/elixir/${ELIXIR_VERSION} && cd /tmp/code/elixir/${ELIXIR_VERSION} && \
git clone -b "v${ELIXIR_VERSION}" --single-branch --depth 1 https://github.com/elixir-lang/elixir.git . && \
make clean test && \
sudo make install && \
cd && rm -rf /tmp/code/elixir && \
echo "Check your elixir version by typing 'iex --version'"
@trajakovic
trajakovic / react-native-clear-all.sh
Last active March 2, 2018 10:32 — forked from EQuimper/clear.txt
React-Native clear Watchman + Cache + Temp
rm /tmp/haste-* /tmp/flow /tmp/metro-* /tmp/socketcluster/ -rf && watchman watch-del-all
yarn start -- --reset-cache
@trajakovic
trajakovic / generate_files.sh
Created April 20, 2017 06:48
Generate binary files with random content...and calculate their sha256
#!/bin/bash
#size magnitude
sizes=( "" "K" "M" )
for magnitude in "${sizes[@]}"; do
for size in `seq 1 5 51`; do
echo "Generating ${size}${magnitude}"
head -c ${size}${magnitude} </dev/urandom >file-${size}${magnitude}.bin
#!/bin/sh
# Detected container limits
# If found these are exposed as the following environment variables:
#
# - CONTAINER_MAX_MEMORY
# - CONTAINER_CORE_LIMIT
#
# This script is meant to be sourced.
@trajakovic
trajakovic / dhclient.conf
Last active April 7, 2017 10:08
Configuration how to /etc/resolv.conf regenerate with local DNS nameserver prepend; works on Fedora(24+) and probably on CentOS7
# update/crete file on location /etc/dhcp/dhclient.conf
# replace 127.0.0.1 with your dns to prepend with
prepend domain-name-servers 127.0.0.1;
@trajakovic
trajakovic / docker_1.13_manual_install_centos.sh
Created March 28, 2017 09:07
Docker 1.13 manual installation on CentOS7 for Openshfit Origin 1.5.0.rc0 (since latest docker version is 17.03, oc cluster up is not happy with version)
yum install wget
wget https://yum.dockerproject.org/repo/main/centos/7/Packages/docker-engine-1.13.1-1.el7.centos.x86_64.rpm
wget https://yum.dockerproject.org/repo/main/centos/7/Packages/docker-engine-selinux-1.13.1-1.el7.centos.noarch.rpm
#nice site with pckgs: https://pkgs.org/
#package for docker-engine-selinux
yum install -y policycoreutils-python
rpm -i docker-engine-selinux-1.13.1-1.el7.centos.noarch.rpm
@trajakovic
trajakovic / DeleteModelInBatchOnSubscribe.java
Created May 2, 2016 12:51
Android DbFlow Update/Delete/Save models in batch with RxJava - ReactiveX with DbFlow
import android.database.Cursor;
import android.support.annotation.NonNull;
import com.raizlabs.android.dbflow.runtime.DBTransactionInfo;
import com.raizlabs.android.dbflow.runtime.TransactionManager;
import com.raizlabs.android.dbflow.runtime.transaction.BaseTransaction;
import com.raizlabs.android.dbflow.runtime.transaction.QueryTransaction;
import com.raizlabs.android.dbflow.runtime.transaction.TransactionListener;
import com.raizlabs.android.dbflow.sql.builder.ConditionQueryBuilder;
import com.raizlabs.android.dbflow.sql.language.Delete;
@trajakovic
trajakovic / create-ca-cert.sh
Created November 13, 2015 13:42
openssl - certificates: create ca, create cert, sign cert, pack cert to p12
#!/bin/bash
openssl genrsa -des3 -out ca.key 4096 && \
echo "CA key generated, file ca.key. Now retype password to create cert" && \
openssl req -new -x509 -days 730 -key ca.key -out ca.crt && \
echo "CA cert generated, file: ca.crt"
@trajakovic
trajakovic / git-security-fix.sh
Created October 26, 2015 08:10
Behind firewall: When git responds with Connection Refused, and heads start with git://
git config --global url."https://".insteadOf git://
@trajakovic
trajakovic / unlimited_bash_history.sh
Created October 23, 2015 14:24
Fedora/unlimited_bash_history
#!/usr/bin/env bash
func_check_for_root() {
if [ ! $( id -u ) -eq 0 ]; then
echo "ERROR: $0 Must be run as root, Script terminating" ;exit 7
fi
}
func_check_for_root
cat <<_EOF_ | sudo tee /etc/profile.d/bash_unlimited_history.sh