Skip to content

Instantly share code, notes, and snippets.

View akhy's full-sized avatar

Akhyar Amarullah akhy

View GitHub Profile
@akhy
akhy / DemoActivity.java
Last active September 9, 2015 07:50 — forked from markusfisch/DemoBubblesView.java
Draw text in a given rectangle and automatically wrap lines on a Android Canvas
package de.markusfisch.android.textrect;
import android.app.Activity;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
@akhy
akhy / gist:91a8005cf0b6baa2854f
Created October 15, 2015 05:15 — forked from maxkandler/gist:5233150
Hide the iTerm2 Dock icon.
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist
@akhy
akhy / ViewPagerAdapter.java
Created January 5, 2016 08:55 — forked from pocmo/ViewPagerAdapter.java
ViewPagerAdapter: Implementation of PagerAdapter that represents each page as a View
/*
* Copyright (C) 2012 Sebastian Kaspari
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@akhy
akhy / README.md
Last active January 5, 2016 10:12 — forked from polbins/README.md
Simple RecyclerView Divider

Simple RecyclerView Divider

Simple Horizontal Divider Item Decoration for RecyclerView

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(
            getApplicationContext()
    	));

NOTE: Add item decoration prior to setting the adapter

@akhy
akhy / android.sh
Created January 26, 2016 06:14 — forked from mikesorae/android.sh
ansible task for android sdk
export PATH="/opt/android-sdk-linux/tools:${PATH}"
@akhy
akhy / MultiDexJunitRunner
Created January 26, 2016 08:46 — forked from mandrachek/MultiDexJunitRunner
AndroidJunitRunner that supports MultiDex
import android.os.Bundle;
import android.support.multidex.MultiDex;
import android.support.test.runner.AndroidJUnitRunner;
public class MultiDexJunitRunner extends AndroidJUnitRunner {
@Override
public void onCreate(Bundle arguments) {
MultiDex.install(getTargetContext());
super.onCreate(arguments);
}
@akhy
akhy / analytics.conf
Created April 27, 2016 08:12 — forked from jirutka/analytics.conf
Add Google Analytics tracking code to HTML via nginx
#
# Add Google Analytics tracking code to HTML response
#
# Usage:
# set $tracking_id 'UA-12345678-9';
# include incl/analytics.conf;
#
# It needs nginx compiled with option --with-http_sub_module.
# Uses optimized GA code from: http://mathiasbynens.be/notes/async-analytics-snippet
#
#!/usr/bin/env perl
# Copyright (c) 2015 Sergey Lyubka
# All rights reserved
use Encode;
my $dir = "/Users/$ENV{USER}/.Trash";
sub read_file($) { local $/; open FD, $_[0] or die $_[0]; binmode FD; <FD>; }
@akhy
akhy / jenkins-git-backup.sh
Created September 2, 2016 07:24 — forked from abayer/jenkins-git-backup.sh
Example of a script for backing up Jenkins config in git.
#!/bin/bash
#
# Copies certain kinds of known files and directories from a given Jenkins master directory
# into a git repo, removing any old ones, adds 'em, commits 'em, pushes 'em.
#
set -ex
if [ $# -ne 2 ]; then
echo usage: $0 root_dir jenkins_master
@akhy
akhy / Jenkins auto-shudown-slaves job
Created February 16, 2017 17:01 — forked from fotinakis/Jenkins auto-shudown-slaves job
Auto-managed Jenkins slaves on Google Compute Engine
#!/bin/bash
# Have to redirect stderr to stdout here because slave.py uses stderr for output.
~/bin/slave.py list 2>&1 >/dev/null | grep beaker-slave- | while read slave; do
echo
echo "Checking status of $slave..."
# First, check if we can SSH into the host. If we can, then check the process and maybe shut down.
# This makes sure that we don't consider an SSH failure to be reason to shut down the node.
if ssh $slave echo < /dev/null; then