Skip to content

Instantly share code, notes, and snippets.

View peat-psuwit's full-sized avatar

Ratchanan Srirattanamet peat-psuwit

View GitHub Profile
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
@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:
/*
* PCINT7Seg.c
*
* Created: 30/4/2561 21:44:33
* Author : peath
*/
#include <avr/io.h>
#include <avr/interrupt.h>
/*
* UartTest.c
*
* Created: 30/4/2561 20:04:00
* Author : peath
*/
#include <avr/io.h>
void UART_init() {
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]
@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
};
@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 / 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 / ParseString.java
Created March 12, 2017 13:36
Parse the string that starts with "A9" (include next 2 letters) and "B1" (include 2 last letters). F2-2016.
import java.util.*;
public class ParseString {
public static ArrayList<String> parse(String input) {
ArrayList<String> result = new ArrayList<>();
String[] splitInput = input.split(",");
for (int i = 0; i < splitInput.length; i++) {
String s = splitInput[i].trim();
@peat-psuwit
peat-psuwit / SketchExtra.ino
Created February 24, 2017 12:04
Speed up and slow down motors, then reverse.
/*
* Author: Ratchanan Srirattanamet
*/
int Menable = 6; //PWM capable
int MdriveA = 5;
int MdriveB = 4;
int delaytime = 300;
void setup() {