Skip to content

Instantly share code, notes, and snippets.

View miao1007's full-sized avatar
🖥️
Free at night on work day.

みゃお miao1007

🖥️
Free at night on work day.
  • Huawei Technologies Co., Ltd.
  • ShenZhen, China
View GitHub Profile
@miao1007
miao1007 / modified_date.js
Created June 26, 2022 15:33
Hexo use modified date from git commit log
const childProcess = require('child_process');
/**
* use `page.modified` in your theme
*/
hexo.extend.filter.register('before_post_render', function (data) {
data.title = data.title.toLowerCase();
data.modified = git_log(data.full_source)
return data;
});
@miao1007
miao1007 / system_profiler.sh
Last active July 28, 2021 11:03
Get current mac AC Charger power by command line
# brew install jq is required
system_profiler SPPowerDataType -json | jq '.SPPowerDataType[] | select(._name == "sppower_ac_charger_information").sppower_ac_charger_watts | tonumber' # eg response
# response example: 87
@miao1007
miao1007 / CMakeLists.txt
Created May 6, 2017 16:03
CMakeLists for Jamvm on Clion, no more red symbol
cmake_minimum_required(VERSION 3.4)
project(jamvm_2_0_0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES
src/arch/arm.h
src/arch/i386.h
src/arch/mips.h
src/arch/parisc.h
package com.xxxx.xxxx.xxx.utils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@miao1007
miao1007 / BlurDrawable.java
Last active June 26, 2018 09:57
BlurDrawable
package com.github.miao1007.myapplication;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
@miao1007
miao1007 / wallpaper.sh
Last active April 3, 2016 17:36
download himawari8 wallpaper for mac
#!/bin/sh
#delay 30 minute
delay=-v-30M
#image location
location=$HOME/Pictures/himawari8
date=$(date -u $delay "+%Y/%m/%d")
file_name=$(date -u $delay "+%H")$(echo "($(date -u $delay "+%M"))/10 * 10" | bc)"00_0_0.png"
url=http://himawari8-dl.nict.go.jp/himawari8/img/D531106/1d/550/$date/$file_name
@miao1007
miao1007 / install.sh
Created November 20, 2015 14:04
Install Golang on Mac
#!/bin/sh
#install go with brew
brew update
brew install go
#make go dir
cd ~
mkdir goroot
mkdir gopath
@miao1007
miao1007 / APDUUtils.java
Created November 7, 2015 06:21
APDUUtils
import okio.ByteString;
/**
* Created by leon on 8/23/15.
* 数据传输单元转换封装
*/
public class APDUUtils {
/**
* Eg: getBitInByte(0x80,7) == true
@miao1007
miao1007 / build.gradle
Created September 3, 2015 11:54
Retrofit 2.0 RxJava Sample
dependencies {
compile 'io.reactivex:rxjava:1.0.12'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta1'
}
@miao1007
miao1007 / DownloadUtils.java
Last active March 29, 2019 06:50
Fir.im check for update
/**
* Created by leon on 2/16/15.
* Download update apk with SystemService.
* require: <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
*/
public class DownloadUtils {
public static String MINETYPE_APPLCATION = "application/vnd.android.package-archive";
public static long DownloadApkWithProgress(Context context, String url) {