Skip to content

Instantly share code, notes, and snippets.

View hatamiarash7's full-sized avatar
🤖
*beep boop* overworked !

Arash Hatami hatamiarash7

🤖
*beep boop* overworked !
View GitHub Profile
@hatamiarash7
hatamiarash7 / LEARN-4.md
Created February 22, 2018 23:16
Install Certum Certificate
  • buy
  • make CSR / Private
  • cat SHA-2.crt Certum_Domain_Validation_CA_SHA2.crt Certum_Trusted_Network_CA.crt mine > bundle.crt
  • copy certs to /usr/local/share/ca-certificates
  • sudo update-ca-certificates
  • reboot
  • config nginx / reload
  • check using : openssl s_client -connect domain:443 -CApath /etc/ssl/certs
@hatamiarash7
hatamiarash7 / LEARN-5.md
Last active February 23, 2018 18:06
Install Certum Certificate - Ubutnu
  • CSR / Private / buy
  • cat SHA-2.crt Certum_Domain_Validation_CA_SHA2.crt Certum_Trusted_Network_CA.crt mine > bundle.crt
  • copy certs to /usr/local/share/ca-certificates
  • sudo update-ca-certificates
  • reboot
  • config nginx / reload
  • check using : openssl s_client -connect domain:443 -CApath /etc/ssl/certs
@hatamiarash7
hatamiarash7 / LEARN-6.md
Created February 23, 2018 18:09
Android Toolbar Logo Size
  • MDPI : 75x32
  • HDPI : 112x48
  • XHDPI : 149x64
  • XXHDPI : 225x96
  • XXXHDPI : 300x128
@hatamiarash7
hatamiarash7 / hideStatusbar.java
Created March 19, 2018 21:42
Android - Hide statusbar
public static void hideStatusbar(Activity context) {
if (Build.VERSION.SDK_INT < 16) {
context.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
View decorView = context.getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
}
@hatamiarash7
hatamiarash7 / UID.java
Created March 26, 2018 16:52
Android Generate Unique ID
@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 +
@hatamiarash7
hatamiarash7 / Validation.java
Created March 26, 2018 16:53
Android Validation rules
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 / Upload.java
Created March 26, 2018 21:28
Android File Upload
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 / 1. Install Redis
Created May 31, 2018 14:37 — forked from pbolduc/1. Install Redis
Install redis on CentOS 7
# 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 / LEARN-7.md
Last active June 8, 2018 09:07
Configure Git to use a proxy
  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

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