Skip to content

Instantly share code, notes, and snippets.

View peat-psuwit's full-sized avatar

Ratchanan Srirattanamet peat-psuwit

View GitHub Profile
@peat-psuwit
peat-psuwit / checkWays.pro
Created May 13, 2017 15:11
Robot can walk 3/5 units at a time. Can it walk N units?
checkWays(0).
checkWays(N) :-
N >= 5,
M is N - 5,
checkWays(M).
checkWays(N) :-
N >= 3,
M is N - 3,
@peat-psuwit
peat-psuwit / isTwice.pro
Created May 14, 2017 04:46
Check if the sequence is the same sequence of letters twice.
furious([], L2, L2).
furious([X|L1], L2, [X|L3]) :-
furious(L1, L2, L3).
isTwice(Full) :-
furious(Half, Half, Full).
@peat-psuwit
peat-psuwit / flow-type-refinement.js
Created January 19, 2018 15:16
Flow type refinement
/* @flow */
type A = {
x: number
};
type B = A & {
y: string
};
http://www.voovlive.com/voov-web/user/checkStatus?uins=[VOOV ID]
http://www.voovlive.com/voov-web/user/getUserInfo?uin=[VOOV ID]
http://www.voovlive.com/voov-web/live/getLiveVideoUrl?room_id=[ROOM ID]&uin=[VOOV ID]
http://www.voovlive.com/voov-web/live/getRoomInfo?room_id=[ROOM ID]&uin=[VOOV ID]
// แถม
http://www.voovlive.com/voov-web/live/getList?room_id=[ROOM ID]&uin=[VOOV ID]
/*
* UartTest.c
*
* Created: 30/4/2561 20:04:00
* Author : peath
*/
#include <avr/io.h>
void UART_init() {
/*
* PCINT7Seg.c
*
* Created: 30/4/2561 21:44:33
* Author : peath
*/
#include <avr/io.h>
#include <avr/interrupt.h>
@peat-psuwit
peat-psuwit / gradle_build_exception.log
Last active October 11, 2018 16:07
Gradle build exception for "Android project build failed when locale is th_TH.UTF-8"
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
> Internal error when trying to read zip file '/home/peat/.gradle/caches/transforms-1/files-1.1/appcompat-v7-28.0.0.aar/46507a4048c6dea1904def8fac41d1bf/jars/classes.jar'.
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
diff --git a/.gitignore b/.gitignore
index 5d64756..0f62530 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,3 +54,6 @@ buck-out/
# Bundle artifact
*.jsbundle
+
+# Ignore google-services.json because this is a demo app
@echo off
rem set the version of jdk you would like to use (1.4, 1.5, 1.6, etc)
set JDK_Version=1.8
set Located=
echo.
echo Locating JDK %JDK_Version%
for /d %%i in ("%ProgramFiles%\Java\jdk%jdk_Version%*") do (set Located=%%i)
rem check if JDK was located
@peat-psuwit
peat-psuwit / qcamerasvr_wrapper.sh
Created August 21, 2019 07:10
How to run a daemon and collect ftrace from it. (The example is mm-qcamera-daemon)
#!/system/bin/sh
echo 'function_graph' >/sys/kernel/debug/tracing/current_tracer
echo 96000 > /d/tracing/buffer_size_kb
echo $$ > /sys/kernel/debug/tracing/set_ftrace_pid
echo 1 > /sys/kernel/debug/tracing/tracing_on
(
sleep 10 # stop tracing after this second.