Skip to content

Instantly share code, notes, and snippets.

@edwardstock
edwardstock / buildphp_deb.sh
Last active March 19, 2017 10:43
How to build PHP 7 (nginx + fpm+cli) on debian/ubuntu
#!/usr/bin/env bash
# getting deps
apt-get install -y git make gcc g++ autoconf re2c bison \
libxml2 libxml2-dev \
libevent-2.0* libevent-dev \
libssl1.0.0 libssl-dev \
libzip2 libzip-dev \
libbz2-dev \
libgd3 libgd-dev \
libmcrypt4 libmcrypt-dev \
@edwardstock
edwardstock / gcc 5 on ubuntu 14.04
Created July 1, 2017 12:03 — forked from beci/gcc 5 on ubuntu 14.04
use gcc 5.x 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
@edwardstock
edwardstock / drive_backup.sh
Last active August 10, 2017 21:19
GoogleDrive files backup with "gdrive" https://github.com/prasmussen/gdrive
#!/bin/sh
# Example cron usage:
# 0 12 * * MON /usr/bin/drive_backup /var/www/public/ >> /var/log/drive_backup.log
# ^every monday at 12:00PM ^path to backup on google drive ^stream redirect ^path to backup log
# Basic manual usage
# drive_backup /path/to/directory/or/file
# File names will contains full path and date for uniqueness.
@edwardstock
edwardstock / git_global_ignore.sh
Created August 11, 2017 15:46
How to GIT ignore: global ignoring files
# Command to use global .gitignore file:
touch ~/.gitignore
echo ".DS_STORE" >> ~/.gitignore
echo ".idea/" >> ~/.gitignore
git config --global core.excludefile '~/.gitignore'
@edwardstock
edwardstock / .gitignore
Created August 11, 2017 16:00 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
/*
* Copyright 2017 Eduard Maximovich
* Atlas
*/
apply plugin: 'maven'
version = VERSION_NAME
group = GROUP
@edwardstock
edwardstock / centos.install.boost.md
Last active April 2, 2018 15:23 — forked from 1duo/centos.install.boost.md
Install Boost library from source on CentOS 7.
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 && cd boost_1_65_1
#!/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 / DecimalInputFilter.java
Created August 31, 2018 12:51
Android Decimal Number Input Filter
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 / git_fix_permissions.sh
Created September 13, 2018 17:04
GIT revert file mode changes
#!/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'