Skip to content

Instantly share code, notes, and snippets.

@ftabashir
ftabashir / Git_SSL_Certificate_Error.txt
Last active August 30, 2017 06:49
this is a how to solve for this git problem: fatal: unable to access 'https://domain.com/path/to/git': SSL certificate problem: unable to get local issuer certificate. REFERENCE: to see original post visit here: https://stackoverflow.com/questions/11621768/how-can-i-make-git-accept-a-self-signed-certificate/26785963#26785963
SSL Certificate error:
- To permanently accept a specific certificate
1. Initial clone
- GIT_SSL_CAINFO=/path/to/cert.pem git clone https://repo.or.cz/org-mode.git
2. Ensure all future interactions with origin remote also work
- cd my-repo-directory
- git config http.sslCAInfo /etc/ssl/certs/rorcz_root_cert.pem
- To disable TLS/SSL verification for a single git command
git -c http.sslVerify=false clone https://domain.com/path/to/git
- To disable SSL verification for that singular repository
@ftabashir
ftabashir / Android_Release_Problems
Last active December 13, 2017 06:18
common problems during release build variant in android
PROBLEM: Could not find tools.jar. Please check that C:\Program Files\Java\Jre8" is a valid JDK install
SOLUTION: I just added a gradle.properties file with the following content:
org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_45
PROBLEM: 'build\intermediates\res\resources-release-stripped.ap_' specified for property 'resourceFile' does not exist
SOLUTION: shrinkResources works only if there is minifyEnabled set to true
PROBLEM: Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'
package com.iranfmcg.dokan.customer.helper;
import android.os.AsyncTask;
import android.support.annotation.MainThread;
import android.support.annotation.WorkerThread;
/* Copyright (C) Farzad Tabashir <ftabashir@gmail.com> 15 February 2017, 8:38 AM
* All Rights Reserved
*/
public abstract class SafeAsyncTask<Params, Progress, Result> {
@ftabashir
ftabashir / sub.py
Last active December 13, 2017 06:13
ModifyFarsiEnglishSubtitleDirection: when we type rtl and ltr text in the same file in envirements which doesn't support rtl, it scrambles text. this python script tries to fix it.
import sys
def subModify(subtitleStr):
modified = []
words = subtitleStr.split()
insertIndex = -1
curIsEn = False
preIsEn = False
for word in words:
preIsEn = curIsEn
@ftabashir
ftabashir / versionName.cmd
Created December 18, 2017 05:32
a batch file to get versionName of apk (in windows)
aapt.exe dump badging %1 | findstr versionName
pause
@ftabashir
ftabashir / play_mp3.py
Created January 20, 2018 21:08
python - play random mp3 using windows media player
# example of running this file: python play_mp3.py path/to/root/mp3/directory 45
# 45 in above example is number of files to play (optional)
import os,random,time,sys,subprocess,threading
def getFiles(path, extension, recursive=True):
files = []
directories = []
for path,directory,element in os.walk(path,False):
if recursive:
docker pull node:8.12-alpine
docker image ls
docker image rm
docker run --name <container-name> node:8.12-alpine
docker ps -a
docker rm <container-name>
docker run -it --name dnode node:8.12-alpine sh
docker start dnode
docker stop dnode
docker restart dnode
@ftabashir
ftabashir / safe-object.ts
Last active October 31, 2018 12:02
safe Object property access, using ES6's Proxy and also make it typed!
/*
Using ES6's Proxy for safe Object property access
This gist is inspired from:
https://gidi.io/2016/02/07/using-es6-s-proxy-for-safe-object-property-access.html
*/
const isObject = (obj: any) => obj && typeof obj === "object";
const hasKey = (obj: any, key: string | number | symbol) => key in obj;
const UndefinedObj: ProxyHandler<{}> = new Proxy(
- when to use removeObservers?
- reuse LD in repo or create new instance per repo requet? i prefer to reuse
- use singleton repos?
- use single event? or LiveData.setValue(null)?
- best practice: use Event class (see https://link.medium.com/qjuB2VGnoV)
- use live data or single event in repo?
- if we don't reuse LD in repo, then we could use LD (single event is useless)
- observeForever is not implemented in single live event
- mediators internally use observeForever
- Use a repo livedata in two view models:
- Create Security Profiles
- Wireless -> Security Profiles
- Create wireless interface
- Wireless -> Interfaces -> add Virtual AP
- name: wlan2
- SSID: my_custom_ssid
- Master Interface: wlan
- Assign an IP Pool and Address
-  IP -> Address > +
- Address: 10.10.10.1/24