Skip to content

Instantly share code, notes, and snippets.

Avatar

Ingram Chen ingramchen

View GitHub Profile
@ingramchen
ingramchen / ubuntu20-04-tweak.md
Last active Nov 8, 2020
Ubuntu 20.04 tweak memo
View ubuntu20-04-tweak.md

Environment

  • Ubuntu 20.04
  • AMD CPU/GPU

Gnome shell extensions

  • sudo apt install gnome-shell-extensions
  • TODO install more extension and chrome extension
    • Dash to Panel
@ingramchen
ingramchen / 00-ubuntu-intellij-macosx.md
Last active Apr 25, 2021
Use ubuntu/Intellij like macOS X
View 00-ubuntu-intellij-macosx.md

How to mimic full macOS Intellij behavior in Ubuntu

  • Enviroment
    • Ubuntu 20.04
    • Intellij IDEA 2020

Ubuntu gnome shell shortcuts

@ingramchen
ingramchen / gist:e2af352bf8b40bb88890fba4f47eccd0
Created Apr 5, 2016
ffmpeg convert gif to mp4, for best cross browser compatibility
View gist:e2af352bf8b40bb88890fba4f47eccd0
### Full command line options
```
ffmpeg -f gif -i FOO.gif -pix_fmt yuv420p -c:v libx264 -movflags +faststart -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' BAR.mp4
```
### Notie
* output mp4 is encoded with h264, support Firefox/Chrome/Safari in Windows, Mac OSX, Android, and iOS.
View gist:adacc38c22f6506c0053
// good for unit test
public static int scanAvailablePort() throws IOException {
try (ServerSocket serverSocket = new ServerSocket(0)) {
return serverSocket.getLocalPort();
}
}
@ingramchen
ingramchen / .gitignore
Last active Oct 9, 2020 — forked from BennettSmith/.gitignore
Build protobuf 2.6 static library for iOS, base on BennettSmith's work
View .gitignore
protobuf
protobuf-2.6.1
protobuf-master
@ingramchen
ingramchen / gist:21533bbfc0d2dead94a7
Last active Apr 25, 2016
思源 ubuntu CJK fonconfig 設定檔
View gist:21533bbfc0d2dead94a7
<fontconfig>
<match target="pattern">
<test qual="any" name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Noto Sans T Chinese</string>
<string>Noto Sans S Chinese</string>
<string>Noto Sans Japanese</string>
<string>Noto Sans Korean</string>
@ingramchen
ingramchen / gist:f2ac2c1c96e8a8717c15
Last active Aug 29, 2015
展示 Java 8 與 Java 7 兩者撰寫上差異
View gist:f2ac2c1c96e8a8717c15
package com.liquable.nemo.model;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.summingLong;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ingramchen
ingramchen / gist:98d0cc3b325999fa0a7a
Created May 8, 2014
Embed Tomcat with nio connector
View gist:98d0cc3b325999fa0a7a
Tomcat tomcat = ....
final Connector nioConnector = new Connector(Http11NioProtocol.class.getName());
nioConnector.setPort(58090);
nioConnector.setSecure(false);
nioConnector.setScheme("http");
nioConnector.setProtocol("HTTP/1.1");
try {
nioConnector.setProperty("address", InetAddress.getByName("localhost").getHostAddress());