Skip to content

Instantly share code, notes, and snippets.

View prongbang's full-sized avatar
🏠
Working from home

prongbang prongbang

🏠
Working from home
View GitHub Profile
# Clone and build OBS
git clone --recursive https://github.com/obsproject/obs-studio.git
cd obs-studio
# Follow normal OBS build steps
brew install FFmpeg x264 Qt5 cmake mbedtls swig
mkdir build
cd build
export QTDIR=/usr/local/opt/qt
cmake ..

Setup Git Repo Local

Windows

Open CMD

  • Open PowerShell
$ powershell
import SwiftUI
struct ContentView: View {
@State var selectedView = 1
var body: some View {
VStack {
TabView(selection: $selectedView) {
Text("Tab Content 1")
@prongbang
prongbang / RecyclerViewScrollToTop.md
Created November 22, 2019 07:31
RecyclerView Scroll to top
import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver

myAdapter.apply {
  registerAdapterDataObserver(object : AdapterDataObserver() {
    override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
      if (positionStart == 0) {
        recyclerView.layoutManager?.scrollToPosition(0)
      }
 }
object TimeAgo {
private val SECOND_MILLIS = 1000
private val MINUTE_MILLIS = 60 * SECOND_MILLIS
private val HOUR_MILLIS = 60 * MINUTE_MILLIS
private val DAY_MILLIS = 24 * HOUR_MILLIS
fun getTimeAgo(time: Long): String? {
var time = time
if (time < 1000000000000L) {

1 Determine the package name of the app, e.g. "com.example.someapp". Skip this step if you already know the package name.

adb shell pm list packages
​

2 Get the full path name of the APK file for the desired package.

fun checkLocationServiceSettings(activity: Activity) {
val googleApiClient = GoogleApiClient.Builder(activity)
.addApi(LocationServices.API)
.build()
googleApiClient.connect()
val builder = LocationSettingsRequest.Builder()
.apply {
@prongbang
prongbang / golang-tls.md
Created August 4, 2019 15:43 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
/Users/username/.gradle/wrapper/dists
class Cmake < Formula
desc "Cross-platform make"
homepage "https://www.cmake.org/"
url "https://github.com/Kitware/CMake/releases/download/v3.10.2/cmake-3.10.2.tar.gz"
sha256 "80d0faad4ab56de07aa21a7fc692c88c4ce6156d42b0579c6962004a70a3218b"
head "https://cmake.org/cmake.git"
bottle do
cellar :any_skip_relocation
sha256 "5c421f98d773951dc9cdb0888e01262e65243c1c19c05e6126293c30e835f912" => :mojave