Skip to content

Instantly share code, notes, and snippets.

View Mirochiu's full-sized avatar

Chiu, Yung-Hsiang Mirochiu

View GitHub Profile
@Mirochiu
Mirochiu / fix_run_monkeyrunner .txt
Created December 11, 2020 02:35
fix monkeyrunner not run in windows command prompt
Assume that the android sdk path in your windows system is C:\Users\%USERNAME%\AppData\Local\Android\Sdk
1. fix monkeyrunner not found
add below directory to your system path
C:\Users\%USERNAME%\AppData\Local\Android\Sdk\tools\bin
2. fix SWT folder not found
@Mirochiu
Mirochiu / main.yml
Created December 10, 2020 02:18
gihub action yml file for building react-native android app
name: build-react-native-android-app
on:
push:
tags:
- 'v*rel*'
jobs:
build:
runs-on: ubuntu-16.04
@Mirochiu
Mirochiu / MainActivity.java
Last active May 25, 2020 06:19
Auto scrolling TextView in constraint layout
// in your onCreate of MainActivity.java
final TextView txtMsgView = findViewById(R.id.textView);
txtMsgView.setMovementMethod(new ScrollingMovementMethod()); // Let users use the mouse or touchpad to move the scroll
txtMsgView.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Mirochiu
Mirochiu / dumpMulticastPackets.py
Created March 3, 2020 10:07
demo for dumping the multicast packets to file
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import socket
import struct
import sys
import signal
import time
recv_addr = ("224.1.1.1", 12345)
@Mirochiu
Mirochiu / forceIpv4Requests.py
Created March 3, 2020 05:33
force requests to use ipv4/ipv6
#!/usr/bin/python
# -*- encoding: utf-8 -*-
# ref:https://stackoverflow.com/questions/33046733
import requests
import socket
import ssl
try:
from http.client import HTTPConnection
@Mirochiu
Mirochiu / gist:6ece8e23f92b15f9b0aed5653cc88e24
Created March 2, 2020 08:51
a simple google app script
var testGet = {
parameters:{},
contextPath:"",
contentLength:-1,
queryString:"",
parameter:{}
};
function doGet(req) {
Logger.log('get');
@Mirochiu
Mirochiu / gist_aws_upload.js
Created February 23, 2020 06:05
An aws s3 uploading sample code in Node.js
console.log('Arg list below:');
process.argv.forEach((val, index) => {
console.log(`${index}: ${val}`);
});
function isEmpty(obj) {
return !Object.keys(obj).length;
}
var args = process.argv.slice(2);
import android.content.Context;
import android.content.ContentResolver;
import android.provider.Settings;
import android.content.res.Resources;
private void readSomething() {
try {
Context mContext = getApplicationContext();
ContentResolver mContextRes = mContext.getContentResolver();
@Mirochiu
Mirochiu / mp4cat.cmd
Created December 31, 2019 03:24
a simple script for concating MP4 files which assigned in a text file
cls
@echo off
set in_file=%1
echo in_file=%in_file%
set out_file=%~dpn1.mp4
echo out_file=%out_file%
ffmpeg.exe -f concat -safe 0 -i %in_file% -c copy "%out_file%"
rem pause
@Mirochiu
Mirochiu / ExtractAndRotateVideo.cmd
Created December 31, 2019 02:40
Extract video part of the input media file and rotate it 90 degree
cls
@echo off
set in_file=%1
echo in_file=%in_file%
set out_file=%~dpn1_rotated%~x1
echo out_file=%out_file%
ffmpeg.exe -i %in_file% -metadata:s:v rotate="90" -sn -an -vcodec copy "%out_file%"
rem pause