Skip to content

Instantly share code, notes, and snippets.

View trajakovic's full-sized avatar

Tomislav trajakovic

  • Score Alarm
  • Zagreb
View GitHub Profile
#!/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 / 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 / package.json
Last active December 28, 2015 18:39
NodeJs simple static HTTP server. Usage: * Fetch package.json and server.js (same folder) * static content should be placed in public/ folder * run: npm install && npm start
{
"name": "kibana-server",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "3.4.4"
}
@trajakovic
trajakovic / default-mapping.json
Last active December 28, 2015 18:38
ElasticSearch JSON mapping configuration (place in $ELASTICSEARCH\conf\default-mapping.json)
{
"_default_": {
"properties": {
"my_hash_field": {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
@trajakovic
trajakovic / tar_folder.sh
Created October 23, 2013 11:47
Tar combinations
-z: Compress archive using gzip program
-c: Create archive
-v: Verbose i.e display progress while creating archive
-f: Archive File name
(this creates archive)
tar -zcvf archive_name.tar.gz /home/tom/and/jerry/
@trajakovic
trajakovic / gist:6281772
Last active December 21, 2015 08:59
AppFrog - demo1
{
"msg" : "This is gist connection test"
}
@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