Skip to content

Instantly share code, notes, and snippets.

View eneim's full-sized avatar
😀
the simple, the best

Nam Nguyen eneim

😀
the simple, the best
View GitHub Profile
@eneim
eneim / android_record.sh
Last active October 25, 2017 06:11
Create Android Screen Record with Android Device Screen.
# Modified from https://paul.kinlan.me/android-screen-recording-and-device-framing/
# Original gist: https://gist.github.com/PaulKinlan/2fdb0c8a6b6f6a646f87
# n6-background.png: https://imgur.com/a/r83EX (it is actually Nexus 5X)
if [ -z "$1" ]; then
shot_path=$(date +%Y-%m-%d-%H-%M-%S).mp4
else
shot_path="$*"
fi
ffmpeg="ffmpeg"
@eneim
eneim / Truss.java
Created October 2, 2017 23:57 — forked from JakeWharton/Truss.java
Extremely simple wrapper around SpannableStringBuilder to make the API more logical and less awful. Apache 2 licensed.
import android.text.SpannableStringBuilder;
import java.util.ArrayDeque;
import java.util.Deque;
import static android.text.Spanned.SPAN_INCLUSIVE_EXCLUSIVE;
/** A {@link SpannableStringBuilder} wrapper whose API doesn't make me want to stab my eyes out. */
public class Truss {
private final SpannableStringBuilder builder;
private final Deque<Span> stack;
@eneim
eneim / height.java
Created March 25, 2017 06:59 — forked from hamakn/height.java
Android: Get height of status, action, navigation bar (pixels)
// status bar height
int statusBarHeight = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
}
// action bar height
int actionBarHeight = 0;
final TypedArray styledAttributes = getActivity().getTheme().obtainStyledAttributes(
@eneim
eneim / README.md
Created March 15, 2017 02:32 — forked from lopspower/README.md
Publish AAR to jCenter and Maven Central

Publish AAR to jCenter and Maven Central

Twitter

Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:

  1. I use "Android Studio" and I have this simple android lib that I would like to be available on maven: CircularImageView

  2. In the library folder(module) I have the lib code abovementioned. And applying in the build.gradle of this folder apply plugin: 'com.android.library' I got as output an .aar in the build/outputs/aar/ directory of the module's directory

@eneim
eneim / packer-ami-id
Created January 21, 2017 07:51 — forked from danrigsby/packer-ami-id
Get AMI ID from a packer build
packer build packer.json 2>&1 | sudo tee output.txt
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt
@eneim
eneim / gifenc.sh
Created October 25, 2016 14:59
Mp4 to Gif
#!/bin/sh
fps=$3
res=$4
palette="/tmp/palette.png"
filters="fps=$fps,scale=$res:-1:flags=bicubic"
palettegenops="stats_mode=diff"
paletteuseops="dither=none"
@eneim
eneim / aozora-api.md
Created October 23, 2016 13:07 — forked from takahashim/aozora-api.md
青空文庫のAPI化についての資料

青空文庫のAPI化についての資料

勝手にまとめているものです。随時更新中(last update: 2015/05/26)

3行まとめ

  • 現状、公式の「青空文庫API(サーバ)」はなさそう
  • 公式サイトでは作品データのCSVを配布している
  • このCSV等を使った「野良APIサーバ」の試みはあった(今もある)
@eneim
eneim / animated-gif.md
Created June 30, 2016 09:02 — forked from stephenlb/animated-gif.md
DIY How to make your own HD Animated GIF Generator

HD Animated GIF Generator

You can make your own HD animated GIF generator.
Follow along with these commands to get started.

HD Animated GIF Generator

git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
@eneim
eneim / InstallationStack.md
Created June 27, 2016 14:02 — forked from pjnovas/InstallationStack.md
Complete Install on Ubuntu Server of Nodejs + MongoDB + NGINX

##Ubuntu Server

NodeJS

sudo apt-get install g++ curl libssl-dev apache2-utils git-core make
cd /usr/local/src
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz
tar -xvzf node-v0.10.28.tar.gz
cd node-v0.10.28
public Observable<FilesWrapper> download(List<Thing> things) {
return Observable.from(things)
.flatMap(thing -> {
File file = new File(getExternalCacheDir() + File.separator + thing.getName());
if (file.exists()) {
return Observable.just(file);
}
Request request = new Request.Builder().url(thing.getUrl()).build();