Skip to content

Instantly share code, notes, and snippets.

View dzungpv's full-sized avatar

Pham Viet Dzung dzungpv

View GitHub Profile
@dzungpv
dzungpv / tz_data.json
Created December 27, 2023 02:38 — forked from alwynallan/tz_data.json
Worldwide timezone data for iotclock.js
{
"servers":[
{"name":"pool.ntp.org"},
{"name":"asia.pool.ntp.org"},
{"name":"europe.pool.ntp.org"},
{"name":"north-america.pool.ntp.org"},
{"name":"oceania.pool.ntp.org"},
{"name":"south-america.pool.ntp.org"}
],
"regions":[
@dzungpv
dzungpv / cleanup_swap.md
Created March 26, 2023 14:22 — forked from anildigital/cleanup_swap.md
Cleanup swap space on macOS

To see current swap usage

sysctl -a | grep swap

Use only when when your system is in a very bad shape

$ sudo pkill -HUP -u _windowserver 
@dzungpv
dzungpv / proguard-rules.pro
Created March 8, 2021 11:30 — forked from jemshit/proguard-rules.pro
Proguard rules for common Android libraries
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
### RxJava, RxAndroid (https://gist.github.com/kosiara/487868792fbd3214f9c9)
-keep class rx.schedulers.Schedulers {
public static <methods>;
@dzungpv
dzungpv / Arduino 230v Light bulb dimming
Created April 27, 2020 12:17 — forked from ryanamaral/Arduino 230v Light bulb dimming
Arduino 230v Light Bulb Dimming (Portugal 220V 50 Hz)
//source: http://electronics.stackexchange.com/q/59615
int AC_LOAD = 3; // Output to Opto Triac pin
int dimming = 128; // Dimming level (0-128) 0 = ON, 128 = OFF
void setup()
{
pinMode(AC_LOAD, OUTPUT); // Set the AC Load as output
attachInterrupt(0, zero_crosss_int, RISING); // Choose the zero cross interrupt # from the table above
}
@dzungpv
dzungpv / build.gradle
Created July 23, 2016 14:56 — forked from ok3141/build.gradle
Gradle obfuscate string
apply from: "$rootDir/utils.gradle"
android {
defaultConfig {
buildConfigField 'String', 'SECRET_KEY', toJavaCodeString(SECRET_KEY)
}
}
@dzungpv
dzungpv / CoreMotion.m
Last active July 6, 2016 03:53 — forked from bwhitman/CoreMotion.m
Example output and query code for the historical "M7" data from CMMotionActivityManager
/*
2013-09-29 21:23:26.468 perf[3911:60b] Sep 26, 2013, 8:47 AM confidence high type walking steps 16
2013-09-29 21:23:26.469 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence high type walking steps 0
2013-09-29 21:23:26.471 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence low type steps 0
2013-09-29 21:23:26.472 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence low type walking steps 0
2013-09-29 21:23:26.474 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence medium type walking steps 0
2013-09-29 21:23:26.475 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence high type walking steps 341
2013-09-29 21:23:26.476 perf[3911:60b] Sep 26, 2013, 9:04 AM confidence high type walking steps 6
2013-09-29 21:23:26.478 perf[3911:60b] Sep 26, 2013, 9:04 AM confidence low type steps 18
2013-09-29 21:23:26.480 perf[3911:60b] Sep 26, 2013, 9:05 AM confidence low type steps 6
@dzungpv
dzungpv / universal-framework.sh
Created June 12, 2016 16:09 — forked from cromandini/universal-framework.sh
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures).
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
@dzungpv
dzungpv / convertLocalizable.rb
Created April 10, 2016 09:30 — forked from florianmski/convertLocalizable.rb
Convert your Localizable.strings (iOS) to strings.xml (Android)
#!/usr/bin/ruby
# based on https://github.com/tmurakam/cashflow/blob/0a01ac9e0350dfb04979986444244f8daf4cb5a8/android/convertStrings.rb
# support comments and Converter such as "%@", "%d", "%0.1f"...
# in your directory : ./main.rb Localizable.strings
file = File.open("strings.xml", "w");
file.puts "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
file.puts "<resources>"
@dzungpv
dzungpv / DeviceUID.m
Created April 10, 2016 08:25 — forked from miguelcma/DeviceUID.m
iOS Unique Device ID that persists between app reinstalls
/* DeviceUID.h
#import <Foundation/Foundation.h>
@interface DeviceUID : NSObject
+ (NSString *)uid;
@end
*/
// Device.m
@dzungpv
dzungpv / gist:76e05aaccdbf0d43cf16
Last active August 26, 2015 17:34 — forked from davidnunez/gist:1404789
list all installed packages in android adb shell
pm list packages -f