Skip to content

Instantly share code, notes, and snippets.

@thanhzusu
thanhzusu / Convert SHA-1 hash in hex format into base64 hash
Created January 24, 2022 09:54
Convert SHA-1 hash in hex format into base64 hash
echo [SHA1 hash in hex format] | xxd -r -p | openssl base64
@thanhzusu
thanhzusu / TrimVideo.swift
Created October 3, 2021 05:16 — forked from acj/TrimVideo.swift
Trim video using AVFoundation in Swift
//
// TrimVideo.swift
// VideoLab
//
// Created by Adam Jensen on 3/28/15.
// Updated for Swift 5 (tested with Xcode 10.3) on 7/30/19.
// MIT license
//
import AVFoundation
@thanhzusu
thanhzusu / print-cert-from-apk
Created November 19, 2020 02:30
Print certification information from APK file
keytool -printcert -jarfile [path/to/file.apk]
@thanhzusu
thanhzusu / export-aab-to-apks
Created November 9, 2020 05:23
How to use bundletool to export aab file to apks?
// Export aab file to apks file
bundletool build-apks --bundle=/MyApp/my_app.aab --output=/MyApp/my_app.apks
--ks=/MyApp/keystore.jks
--ks-pass=file:/MyApp/keystore.pwd
--ks-key-alias=MyKeyAlias
--key-pass=file:/MyApp/key.pwd
// Install apks file
bundletool install-apks --apks=/MyApp/my_app.apks
@thanhzusu
thanhzusu / refresh-expired-token-in-js.js
Created October 6, 2020 03:37
How to refresh expired token in JS?
// ❓ Chuyện gì xảy ra nếu giữa chừng token bị expired?
// Ví dụ: 3 api requests đồng thời với nhau
// TRƯỜNG HỢP 1: Token chưa expired, vẫn còn tốt chán 🤣
// --request 1-->
// --request 2-->
// --request 3-->
@thanhzusu
thanhzusu / clear-local-dns-cache-macos.txt
Created June 1, 2020 07:23
How to clear the local DNS cache in Mac OS?
1. dscacheutil -flushcache
2. sudo killall -HUP mDNSResponder
@thanhzusu
thanhzusu / SHA-1 fingerprint of keystore certificate
Last active August 11, 2020 09:24
SHA-1 fingerprint of keystore certificate
By commandline:
keytool -list -v -keystore {keystore_name} -alias {alias_name}
By Android Studio:
1. Run your project
2. Click on Gradle menu
3. Expand Gradle Tasks tree
4. Double click on android -> signingReport and see the magic
5. It will tell you everything on the Run tab
@thanhzusu
thanhzusu / ios-basic-animation
Created April 29, 2020 03:22
iOS - Basic Animation
private func animationGroup(animations:[CAAnimation])->CAAnimationGroup{
let keyframe = CAAnimationGroup()
keyframe.animations = animations
keyframe.duration = 0.7
keyframe.repeatCount = 0
keyframe.delegate = self
return keyframe
}
private func move(fromValue:CGFloat, toValue:CGFloat)->CABasicAnimation{
@thanhzusu
thanhzusu / fixed-issue-push-notification-app-killed
Created February 20, 2020 08:01
Fixed issue receive push notification when app is killed
While developing your app, if sometime you don't see the push notification when the app is killed, you must close your app, then let's open again by tap on the app's icon on the Launcher.
Then close it by swipe off. You will see the magic.
@thanhzusu
thanhzusu / shema.md
Created February 7, 2020 09:10
Download scheme graphql for Android apollo