Skip to content

Instantly share code, notes, and snippets.

💻
Coding ...

Arash Hatami hatamiarash7

💻
Coding ...
Block or report user

Report or block hatamiarash7

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hatamiarash7
hatamiarash7 / MongoDB.json
Created Oct 12, 2019
Chronograf MongoDB Dashboard
View MongoDB.json
{
"meta": {
"chronografVersion": "1.7.14",
"sources": {
"1": {
"name": "Influx 1",
"link": "/chronograf/v1/sources/1"
}
}
},
@hatamiarash7
hatamiarash7 / .env
Created Jul 30, 2019
Docker configurations for Laravel
View .env
DB_CONNECTION = mysql
DB_HOST = db
DB_PORT = 3306
DB_DATABASE = app
DB_USERNAME = root
DB_PASSWORD = root
@hatamiarash7
hatamiarash7 / index.md
Last active May 22, 2019
PHP group array items by key
View index.md

Groups an array into another array by a given $key

function array_group(array $array, $key)
{
    $result = [];

    foreach ($array as $item) {
        $column = $item[$by_column];
        unset($item[$by_column]);
@hatamiarash7
hatamiarash7 / url_mask.js
Created May 21, 2019 — forked from Bewitchedyegor/url_mask.js
URL mask based on jquery.mask.js
View url_mask.js
$('#banner_link').inputmask("url", {
mask: "https://www.*{1,20}[.*{1,20}]",
greedy: false,
clearMaskOnLostFocus: false,
clearIncomplete: false,
definitions: {
'*': {
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
cardinality: 1,
casing: "lower"
View zabbix 3.2, Ubuntu 16.04.1, php7, nginx, postgres.md

cd ~/Downloads

wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb

dpkg -i zabbix-release_3.2-1+xenial_all.deb

apt-get update

should add /etc/apt/sources.list.d/zabbix.list

@hatamiarash7
hatamiarash7 / LEARN-7.md
Last active Jun 8, 2018
Configure Git to use a proxy
View LEARN-7.md
  1. Define proxy in .gitconfig ( You can find it by run this command : git config --list --global --show-origin )

    [http]
        proxy = http://username:password@proxydomain:port
        sslverify = false
    [https]
        proxy = http://username:password@proxydomain:port
        sslverify = false
    
  2. Use environment variable

@hatamiarash7
hatamiarash7 / 1. Install Redis
Created May 31, 2018 — forked from pbolduc/1. Install Redis
Install redis on CentOS 7
View 1. Install Redis
# see How to Install Redis Server on CentOS 7 - http://linoxide.com/storage/install-redis-server-centos-7/
# --- Compiling ---
$ yum install gcc make tcl
$ REDIS_VER=3.2.3
$ wget http://download.redis.io/releases/redis-$REDIS_VER.tar.gz
$ tar xzvf redis-$REDIS_VER.tar.gz
$ cd redis-$REDIS_VER
$ make
$ make test
@hatamiarash7
hatamiarash7 / Upload.java
Created Mar 26, 2018
Android File Upload
View Upload.java
static void uploadFile(Context context, final String selectedFilePath) {
int serverResponseCode = 0;
HttpURLConnection connection;
DataOutputStream dataOutputStream;
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
@hatamiarash7
hatamiarash7 / Validation.java
Created Mar 26, 2018
Android Validation rules
View Validation.java
public static boolean isValidEmail(String target) {
boolean check1 = Patterns.EMAIL_ADDRESS.matcher(target).matches();
Pattern pattern;
Matcher matcher;
String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
pattern = Pattern.compile(EMAIL_PATTERN);
matcher = pattern.matcher(target);
boolean check2 = matcher.matches();
return target.isEmpty() || check1 && check2;
}
@hatamiarash7
hatamiarash7 / UID.java
Created Mar 26, 2018
Android Generate Unique ID
View UID.java
@SuppressWarnings("deprecation")
@SuppressLint("HardwareIds")
public static HashMap<String, String> GenerateDeviceInformation(Context context) {
HashMap<String, String> result = new HashMap<>();
String pseudoId = "35" +
Build.BOARD.length() % 10 +
Build.BRAND.length() % 10 +
Build.CPU_ABI.length() % 10 +
Build.DEVICE.length() % 10 +
Build.DISPLAY.length() % 10 +
You can’t perform that action at this time.