Skip to content

Instantly share code, notes, and snippets.

Zac Siegel zsiegel

Block or report user

Report or block zsiegel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zsiegel
zsiegel / arch_setup.md
Last active Aug 23, 2017
ArchLinux install steps
View arch_setup.md

ARCH LINUX

This is a simple guide with un-encrypted volumes.

  • setup the time
    • timedatectl set-ntp true
  • rank your packman mirrors
    • cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
    • rankmirrors -n 3 /etc/pacman.d/mirrorlist.bak > /etc/pacman.d/mirrorlist
  • update pacman
@zsiegel
zsiegel / systemd-example.md
Last active Aug 4, 2018
systemd example - works on Ubuntu 16.04
View systemd-example.md

Ubuntu 16.04 systemd service setup

Enable persistent user systemd services

loginctl enable-linger $user

Create a user systemd directory

mkdir ~/.config/systemd/user
View git_timesheet.sh
function githarvest() {
local week_ago=$(eval date -v -7d +'%d/%m/%Y')
git log --since $week_ago --author="YOUR GIT NAME HERE" --pretty=format:'%C(yellow)%h|%Cred%ad|%Cblue%an|%Cgreen%d %Creset%s' --date=short
}
@zsiegel
zsiegel / AnimatingDrawerToggle.java
Last active Aug 29, 2015
Animating Drawer Toggle
View AnimatingDrawerToggle.java
public class AnimatingDrawerToggle extends ActionBarDrawerToggle {
public enum State {
UP,
HOME
}
private static final float MENU_POSITION = 0f;
private static final float ARROW_POSITION = 1.0f;
@zsiegel
zsiegel / gist:9de976807e4000995059
Created Mar 6, 2015
Android content transition problem
View gist:9de976807e4000995059
//Setup how the content elements should animate
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(
new Slide(Gravity.TOP).addTarget(R.id.header_container)
//Why do i have to exclude this?
.excludeTarget(R.id.content_container, true));
transitionSet.addTransition(
new Slide(Gravity.BOTTOM).addTarget(R.id.content_container)
@zsiegel
zsiegel / Presenter
Last active Aug 29, 2015
Android MVP Presenter example
View Presenter
public class MyPresenter {
public MyPresenter(IView viewInterface){
}
public void start() {
//this should be called from a onResume() lifecycle method or similar
//subscribe here
}
@zsiegel
zsiegel / gist:ef6573dbbf09ad1ced87
Created Nov 11, 2014
SparseArrayTypeAdapter for testing a square-flow bug
View gist:ef6573dbbf09ad1ced87
package com.square.flow;
import android.util.SparseArray;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
@zsiegel
zsiegel / gist:7919194
Last active Dec 31, 2015
Android Strict Mode
View gist:7919194
public void setupStrictMode() {
StrictMode.enableDefaults();
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.penaltyDeath()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
@zsiegel
zsiegel / build-version.gradle
Last active Jan 9, 2020
Android manifest versioning with gradle and git
View build-version.gradle
task('increaseVersionCode') << {
def manifestFile = file("src/main/AndroidManifest.xml")
def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
def manifestText = manifestFile.getText()
def matcher = pattern.matcher(manifestText)
matcher.find()
def versionCode = Integer.parseInt(matcher.group(1))
android.defaultConfig.versionCode = versionCode + 1
println "Setting version code to ${android.defaultConfig.versionCode}"
def manifestContent = matcher.replaceAll("versionCode=\"" + android.defaultConfig.versionCode + "\"")
View gist:7588299
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
teamSelector.getViewTreeObserver().removeOnGlobalLayoutListener(this);
} else {
teamSelector.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
You can’t perform that action at this time.