Skip to content

Instantly share code, notes, and snippets.

View abbasnaqdi's full-sized avatar
:octocat:
Focusing

Abbas Naqdi abbasnaqdi

:octocat:
Focusing
View GitHub Profile
@abbasnaqdi
abbasnaqdi / high_quality_media_recorder.kt
Last active October 28, 2018 19:31
The MediaRecorder formula is compatible with various Android versions and high-quality audio recorder, Tested on Android 21 to 28
// The MediaRecorder formula is compatible with various Android versions and high-quality audio recorder,
// Tested on Android 21 to 28
mediaRecorder = MediaRecorder().apply {
setAudioSource(MediaRecorder.AudioSource.MIC)
setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)
setAudioEncoder(MediaRecorder.AudioEncoder.HE_AAC)
setOutputFile(filePath)
setAudioEncodingBitRate(320000)
@abbasnaqdi
abbasnaqdi / proto_compile_command
Created July 10, 2018 00:15
proto file compile command
protoc --go_out=plugins=grpc:. path/name.proto
@abbasnaqdi
abbasnaqdi / signature_check
Created July 6, 2018 15:10
signature apk check in runtime
PackageInfo info = null;
try {
info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
if (!Base64.encodeToString(md.digest(), Base64.DEFAULT).equals("sha sign key")) {
@abbasnaqdi
abbasnaqdi / git_ignore_force_history
Last active July 6, 2018 14:57
git ignore force for all history
//use this comment in terminal in project directory
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA' \
--prune-empty --tag-name-filter cat -- --all
git push origin --force --all
//or