Skip to content

Instantly share code, notes, and snippets.

View mio4kon's full-sized avatar
🎯
Focusing

mio4kon

🎯
Focusing
View GitHub Profile
@mio4kon
mio4kon / mapread.c
Created February 9, 2023 09:53 — forked from marcetcheverry/mapread.c
mmap and read/write string to file
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h>
int main(int argc, const char *argv[])
{
2017-06-08 16:36:08:082 - [debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 4799
2017-06-08 16:36:08:083 - [debug] [ADB] Forwarding system: 4799 to device: 6790
2017-06-08 16:36:08:083 - [debug] [ADB] Running '/Users/mio4kon/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","b19e1e86","forward","tcp:4799","tcp:6790"]
2017-06-08 16:36:08:096 - [debug] [ADB] Getting connected devices...
2017-06-08 16:36:08:111 - [debug] [ADB] 1 device(s) connected
2017-06-08 16:36:08:112 - [debug] [ADB] Running '/Users/mio4kon/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","b19e1e86","shell","dumpsys","window"]
2017-06-08 16:36:08:150 - [AndroidDriver] Screen already unlocked, doing nothing
2017-06-08 16:36:08:152 - [debug] [ADB] Getting connected devices...
2017-06-08 16:36:08:163 - [debug] [ADB] 1 device(s) connected
2017-06-08 16:36:08:165 - [debug] [ADB] Running '/Users/mio4kon/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","b19e1e86","shell","am","fo
unsigned char script[] = {
0x98, 0xFF, 0x80, // I2C reset
0x98, 0xF4, 0x80, // CEC SLAVE ADDRESS
0x98, 0xF5, 0x7C, // INFOFRAME SLAVE ADDRESS
0x98, 0xF8, 0x4C, // DPLL SLAVE ADDRESS
0x98, 0xF9, 0x64, // KSV SLAVE ADDRESS
0x98, 0xFA, 0x6C, // EDID SLAVE ADDRESS
0x98, 0xFB, 0x68, // HDMI SLAVE ADDRESS
0x98, 0xFD, 0x44, // CP SLAVE ADDRESS
0x98, 0x01, 0x05, // vertical frequency = 60Hz,Prim_Mode =101b HDMI-Comp
View t = toolbar.getChildAt(0);
if (t != null && t instanceof TextView) {
TextView title = (TextView) t;
...
}
@mio4kon
mio4kon / OperatorOverloading.kt
Created August 29, 2016 05:59
Kotlin操作符重载
data class Money(val currency: String, val amount: Int)
operator fun Money.plus(other: Money): Money {
if (currency != other.currency) {
throw IllegalArgumentException("currency 不匹配!")
}
return copy(amount = amount + other.amount)
}
@mio4kon
mio4kon / ListMovies.js
Created August 18, 2016 13:39
React Native 之展示电影列表(v0.31)
/**
* Created by mio4kon on 16/8/18.
*/
import React from 'react'
import {
AppRegistry,
Text,
Image,
StyleSheet,
View,
/**
* Created by mio4kon on 16/8/16.
* companion object 与 init 调用顺序
*/
class CompanionObj {
//构造CompanionObj才打印了
init {
println("init 构造")
}
package com.nonobank.ui.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.support.v4.widget.EdgeEffectCompat;