Skip to content

Instantly share code, notes, and snippets.

@kennyk
kennyk / gist:1bd8143831ef9c5c97eb
Created December 1, 2014 09:37
org.lucasr.twowayview.sample.LayoutAdapter#onBindViewHolder
@Override
public void onBindViewHolder(final SimpleViewHolder holder, int position) {
holder.title.setText(mItems.get(position).toString());
boolean isVertical = (mRecyclerView.getOrientation() == TwoWayLayoutManager.Orientation.VERTICAL);
final View itemView = holder.itemView;
final int itemId = mItems.get(position);
if (mLayoutId == R.layout.layout_staggered_grid) {
@kennyk
kennyk / gist:04da1c2411911376d85c
Last active August 29, 2015 14:23
Batch delete git tags
#delete all remote tags containing "v0"
git ls-remote | grep tags | grep v0 | awk '/^(.*)(\s+)(.*[a-z])/ {print ":" $2}' | grep -v \{ | xargs git push origin
#delete all local tags containing "v0"
git tag -l | grep v0 | awk '/^(.*[a-z])/ {print $1}' | xargs git tag -d
@kennyk
kennyk / clear_intent_flag.java
Created April 21, 2016 10:35
Clear Intent flag
public static void unsetFlag(Intent intent, int flag) {
intent.setFlags(intent.getFlags() & (~flag));
}
@kennyk
kennyk / gist:8104728b5d9be2b5fc33ca4688693ba3
Last active February 20, 2018 08:36
Delete local copies of remote branches
Branches that are local only will not be touched.
Branches that have been deleted on remote but were not merged will show a notification but not be deleted on local.
If you want to delete those as well change `-d` to `-D`.
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d
@kennyk
kennyk / rapsberry_pi_streaming
Last active May 1, 2019 20:26
Notes on live streaming from raspberry pi
Thanks https://johnvoysey.wordpress.com/2014/05/07/raspberry-pi-camera-live-streaming/
libx264
Compiling the libx264 library from source is relatively straightforward. You will need git installed to check out the latest version. Use the following commands to check out, compile & install libx264:
git clone git://git.videolan.org/x264.git
cd x264/
./configure --enable-static --enable-shared
make
make install
@kennyk
kennyk / gource export
Created February 1, 2021 09:34
Export gource rendering to ppm mp4
gource \
-s 30 \
-1280x720 \
--multi-sampling \
--stop-at-end \
--highlight-users \
--font-size 25 \
--output-ppm-stream - \
--output-framerate 30 \
--logo ~/Downloads/favicon.png \
@kennyk
kennyk / iterm2-solarized.md
Created May 23, 2024 07:44 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k