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
void disableScreenRecording({bool enabled = false}) async {
// Get the Android device.
final device = await FlutterDevice.current;
// Run the "adb shell settings put secure allow_screen_captures" command.
final result = await device.run('adb', [
'shell',
'settings',
'put',
'secure',
import 'dart:io';
void main() {
// Get the current platform.
final platform = Platform.isAndroid ? 'android' : 'ios';
// Disable remote desktop for the current platform.
if (platform == 'android') {
// Set the value of the "adb tcpip" command to 0.
Process.run('adb', ['tcpip', '0']);
@prongbang
prongbang / response_xlsx.go
Created March 2, 2023 10:54
Response XLSX data
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/gofiber/fiber/v2"
)
@prongbang
prongbang / CalculateLeave.kt
Created February 28, 2023 07:52
Get date list between start - end date
import java.time.DayOfWeek
import java.time.LocalDate
data class Holiday(
val date: LocalDate,
val userId: Int,
) {
companion object {
val all = listOf(
Holiday(date = LocalDate.of(2023, 2, 6), userId = 1),
@prongbang
prongbang / EmojiConverter.kt
Created October 2, 2022 07:28
Convert Unicode to Emoji for Android
import java.util.regex.Pattern
// How to use
//
// val actual = EmojiConverter.fromUnicode("เพชรพลอย U+1F48E 8920 เพชรพลอย U+1F48E 8920") // เพชรพลอย 💎 เพชรพลอย 💎 8920
// emojiTextView.setText(EmojiCompat.get().process(actual))
//
object EmojiConverter {
fun fromUnicode(textUnicode: String): String {
@prongbang
prongbang / alternative-copy-google-service-info-plist.sh
Last active September 19, 2022 08:21 — forked from tylermilner/copy_appropriate_google-service-info-plist.sh
A shell script to selectively copy your GoogleService-Info.plist into your app bundle based on the current build configuration.
if [ "${CONFIGURATION}" == "Debug-Production" ] || [ "${CONFIGURATION}" == "Release-Production" ];
then
cp "${PROJECT_DIR}/Runner/Firebase/Production/GoogleService-Info.plist" "${PROJECT_DIR}/Runner/GoogleService-Info.plist"
echo "Production plist copied"
elif [ "${CONFIGURATION}" == "Debug-Uat" ] || [ "${CONFIGURATION}" == "Release-Uat" ];
then
cp "${PROJECT_DIR}/Runner/Firebase/Uat/GoogleService-Info.plist" "${PROJECT_DIR}/Runner/GoogleService-Info.plist"
echo "Uat plist copied"
#!/usr/bin/env bash
escapedPath="$(echo `pwd` | sed 's/\//\\\//g')"
if grep flutter pubspec.yaml > /dev/null; then
if [ -d "coverage" ]; then
# combine line coverage info from package tests to a common file
if [ ! -d "$MELOS_ROOT_PATH/coverage" ]; then
mkdir "$MELOS_ROOT_PATH/coverage"
fi
@prongbang
prongbang / gist:1e18c453a60c2772613ea284177e5b95
Created June 29, 2022 09:52 — forked from pich4ya/gist:1ac125726e4f79c6832899e6c9b7bde1
How to capture Xamarin and Flutter HTTPS API traffic using iPhone and MBP
# @author Pichaya Morimoto ([email protected])
# How to capture Xamarin and Flutter HTTPS API traffic using iPhone and MBP
# วิธี mitm ดัก Web API ของ iOS App ผ่าน MacOS -> Burp Suite ที่เป็น unaware proxy
# (เช่น Xamarin, Flutter ที่ไม่วิ่งผ่าน System Proxy ไม่ใช้ default Cert Store ใน iPhone)
# ถ้าเป็นแอปปกติ ที่ใช้ system proxy อยู่แล้วไม่ต้องทำท่านี้ก็ได้ ตั้ง proxy ปกติไปได้เลย
1. เสียบ iPhone (ที่ jailbreak แล้ว) กับ MBP ผ่าน USB แล้วใช้ iproxy ตั้งให้ local port 8080 บน iPhone วิ่งเข้า local port 8080 บน MBP ด้วย ssh reverse tunnel (-R)
$ brew install usbmuxd
$ iproxy 2222 22 & disown && ssh -R 8080:localhost:8080 -p 2222 [email protected] -N -f
import android.annotation.SuppressLint
import android.app.Activity
import android.graphics.Color
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.widget.PopupWindow
import android.widget.RelativeLayout
import android.os.Build