Skip to content

Instantly share code, notes, and snippets.

Avatar

Eduard edwardstock

  • Turkey, Antalya
View GitHub Profile
@edwardstock
edwardstock / git_fix_permissions.sh
Created Sep 13, 2018
GIT revert file mode changes
View git_fix_permissions.sh
#!/usr/bin/env bash
cd $1
git diff -p -R --no-color | grep -E "^(diff|(old|new) mode)" --color=never | git apply
## add git alias with name "permission-reset"
git config --global --add alias.permission-reset '!git diff -p -R --no-color | grep -E "^(diff|(old|new) mode)" --color=never | git apply'
@edwardstock
edwardstock / DecimalInputFilter.java
Created Aug 31, 2018
Android Decimal Number Input Filter
View DecimalInputFilter.java
public class DecimalInputFilter extends android.text.method.DigitsKeyListener {
private final WeakReference<EditText> mView;
private int mDecimals = 18;
public DecimalInputFilter(EditText txtView) {
this(txtView, 18);
}
public DecimalInputFilter(EditText txtView, int decimals) {
super(false, true);
@edwardstock
edwardstock / Build-GCC-README.md
Last active Mar 1, 2019
GNU GCC 8.1 automated build script
View Build-GCC-README.md
View pgsql.helpers.sh
# init new database
# dir: /usr/pgsql-$VERS
initdb -A trust --auth-local=trust --encoding=UTF8 --pgdata=/var/pgsql10
# dump old database (-O [--no-owners] - drops owners assignment, by default in new db's rights will grant to importer)
pg_dumpall -O -U postgres > /var/db.out
# import database dump
psql -f db.out postgres
View centos.install.gcc7.sh
#!/bin/bash
yum install centos-release-scl
yum install devtoolset-7-gcc*
# enable bin (originally installed to /opt/rh/devtoolset-7/root/ )
# scl exports to $PATH /opt/rh/devtoolset-7/root/bin/*
scl enable devtoolset-7 bash
# check
`which g++` -v
@edwardstock
edwardstock / centos.install.boost.md
Last active Apr 2, 2018 — forked from 1duo/centos.install.boost.md
Install Boost library from source on CentOS 7.
View centos.install.boost.md
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
  • Unzip
tar -xzf boost_1_65_1.tar.gz &amp;&amp; cd boost_1_65_1
View atlas-mvn-push.gradle
/*
* Copyright 2017 Eduard Maximovich
* Atlas
*/
apply plugin: 'maven'
version = VERSION_NAME
group = GROUP
@edwardstock
edwardstock / .gitignore
Created Aug 11, 2017 — forked from octocat/.gitignore
Some common .gitignore configurations
View .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@edwardstock
edwardstock / git_global_ignore.sh
Created Aug 11, 2017
How to GIT ignore: global ignoring files
View git_global_ignore.sh
# Command to use global .gitignore file:
touch ~/.gitignore
echo ".DS_STORE" >> ~/.gitignore
echo ".idea/" >> ~/.gitignore
git config --global core.excludefile '~/.gitignore'
@edwardstock
edwardstock / gcc 5 on ubuntu 14.04
Created Jul 1, 2017 — forked from beci/gcc 5 on ubuntu 14.04
use gcc 5.x on ubuntu 14.04
View gcc 5 on ubuntu 14.04
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5