Skip to content

Instantly share code, notes, and snippets.

View shiehnpin's full-sized avatar
😄

EnPing shiehnpin

😄
View GitHub Profile
/* =========================================================
* bootstrap-datepicker.js
* http://www.eyecon.ro/bootstrap-datepicker
* =========================================================
* Copyright 2012 Stefan Petre
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
//結果用Path存
//type階層, 數字越大越高層
const typeMap = {
commodity: 0,
product_cat_3: 1,
product_cat_2: 2,
product_cat_1: 3,
};
let idx = 0;
@shiehnpin
shiehnpin / tmate_for_ssh.md
Created January 28, 2021 13:11 — forked from iskolbin/tmate_for_ssh.md
Ubuntu(systemd) tmate service for ssh

The motivation is: ssh to remote computer without port forwading, dynamic DNS and so on, the only thing needed is that the remote is connected to the Internet.

  1. On remote get tmate, put it in /usr/local/bin (apt version as of 18.04LTS is too old):
curl -L https://github.com/tmate-io/tmate/releases/download/2.4.0/tmate-2.4.0-static-linux-amd64.tar.xz|tar xJv
sudo mv tmate-2.4.0-static-linux-amd/tmate /usr/local/bin
  1. Put public keys in ~/.ssh/authorized_keys
fun <T1, T2, R> zip(
source1 : LiveData<T1?>,
source2 : LiveData<T2?>,
source1Name: String = "first",
source2Name: String = "second",
zipFunction: (t1:T1?, t2:T2?, emitter:(R)->Unit) -> Unit
): LiveData<R>{
return object : MediatorLiveData<R>(){
var t1: T1? = null
var t2: T2? = null
DefaultDispatcher-worker-1 start 1
DefaultDispatcher-worker-7 start 7
DefaultDispatcher-worker-4 start 4
DefaultDispatcher-worker-6 start 6
DefaultDispatcher-worker-2 start 3
DefaultDispatcher-worker-3 start 2
DefaultDispatcher-worker-5 start 5
DefaultDispatcher-worker-8 start 8
DefaultDispatcher-worker-7 end 7
DefaultDispatcher-worker-8 end 8
val conn = device.establishConnection(false)
conn
.flatMap(rxBleConnection -> rxBleConnection.setupNotification(battTxCharUuid))
.doOnNext(notificationObservable -> {
conn.writeCharacteristic(battRxCharUuid,cmd).subscribe();
})
.flatMap(notificationObservable -> notificationObservable) // <-- Notification has been set up, now observe value changes.
.subscribe(
bytes -> {
@Test
fun test() = runBlocking<Unit>(Dispatchers.Default) {
var job1: Job? = null
var job2: Job? = null
coroutineScope {
var c1:CoroutineContext? = null
var c2:CoroutineContext? = null
job1 = launch {
c1 = coroutineContext
can't alloc memory 12
https://serverfault.com/questions/671878/suddenly-error-cannot-allocate-memory-errno-12
"Memory: 4k page, physical 1027040k(224852k free), swap 0k(0k free)"
create swap file
http://man.linuxde.net/mkswap
1024*4*1024 = 4194304 (4Gb)
sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=4194304
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<debug-overrides>
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>
當 長按10sec觸發後
設置retain register//GRET2
soft reset
取消retain register 並且 Disable Power按鈕
搜尋是否有Emoji, 如果有
//以下流程已經有只要稍微改下