Skip to content

Instantly share code, notes, and snippets.

View qrtt1's full-sized avatar
💭
work from home

Ching Yi, Chan qrtt1

💭
work from home
View GitHub Profile
FFMPEG=/opt/ffmpeg-live/bin/ffmpeg
for((;;))
do
sleep 1
FILENAME=stat123_for_eng_$(date +"%H%M%S").mp3
echo "save audio into " $FILENAME
$FFMPEG -f avfoundation -i ":0" -vn -acodec mp3 -b:a 96k -ar 44100 $FILENAME
done
@qrtt1
qrtt1 / android-app-build.gradle
Last active September 2, 2016 10:16
Gradle Rule Base API
class ExtraTask extends RuleSource {
@Mutate void createCopyTasks(ModelMap<Task> tasks) {
tasks.grep({it.name.contains("package")})
.grep({!it.name.contains("Test")})
.each {
if(it.name.contains("package")) {
// it 就是 packageXXX 的 task,outputFile 就是他預計輸出的 apk
// 這欄位是查原始碼來的 http://bit.ly/2bH99aw
def outputFile = it.outputFile
// 接著我們建一個新的 copyXXX 的 task 讓原來的 packageXXX 相依它
@qrtt1
qrtt1 / build.gradle
Created May 23, 2016 04:27
Gradle files(), fileTree()
//
// Demo Structure
//
// qty:lab qrtt1$ tree
// .
// ├── build.gradle
// └── libs
// ├── a.jar
// └── vendorA

Java EE is dead. Stop using it

There is a lot of chatter on the internet about Java EE being dead. As someone who spent a lot of time implementing some of the core specs like CDI and also helping customers adopt JavaEE I was interested in determining if this is true.

Unfortunately the anecdotal evidence all points to JavaEE going the way of the DODO slowly. I am here to ring the bell. Please write all your future apps with Spring, LightBend etc., or even no framework.

This is the evidence now points towards JavaEE being dead:

  1. Most of the prominent Java EE evangelists - Folks who in some cases are friends and I admire deeply have left their respective Java EE shepherd companies. Reza Rahman from Oracle, Kenny Bastani from Oracle and Arun Gupta from Redhat to name just a few ...
@qrtt1
qrtt1 / gist:0600220db1ed1720678b
Created February 27, 2016 14:40 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@qrtt1
qrtt1 / stream_to_youtube.sh
Created February 27, 2016 14:28 — forked from olasd/stream_to_youtube.sh
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
@qrtt1
qrtt1 / plugin_audit.h.diff
Created February 20, 2016 21:57
MySQL Audit API Diff 5.5 vs 5.7
root@us5:~/sources# diff -Nur ./percona-server-5.5-5.5.47-37.7/include/mysql/plugin_audit.h ./percona-server-5.7-5.7.10-2rc2/include/mysql/plugin_audit.h
--- ./percona-server-5.5-5.5.47-37.7/include/mysql/plugin_audit.h 2016-01-09 05:32:34.000000000 +0800
+++ ./percona-server-5.7-5.7.10-2rc2/include/mysql/plugin_audit.h 2016-02-05 00:47:54.000000000 +0800
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -17,116 +17,543 @@
@qrtt1
qrtt1 / nodelist.sh
Last active February 18, 2016 01:18
Ansible Dynamic Inventory
#!/bin/env sh
gcloud compute instances list --regexp .*foobarbar.* --format json \
| jq '{"web":{"vars": {"ansible_ssh_user":"i_am_the_king_of_the_world", "ansible_ssh_private_key_file":"/opt/ansible_pass.pem"}, "hosts": [.[].networkInterfaces[].accessConfigs[].natIP]}}'
exit 0
@qrtt1
qrtt1 / aar-deps.gradle
Last active May 19, 2020 16:09
gradle: package *.jar into aar
project.afterEvaluate {
def isAndroidLibraryProject = project.plugins.hasPlugin('com.android.library')
if(isAndroidLibraryProject) {
task copyDeps(type:Copy) {
from configurations.compile {
include '**/*.jar'
}
into "./build/intermediates/bundles/release/libs/"
}
bundleRelease.dependsOn copyDeps
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.FieldDeclaration;