Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am zsiegel on github.
  • I am zac_siegel (https://keybase.io/zac_siegel) on keybase.
  • I have a public key ASCYByFxKK6PPTljWeUDyY0yPJ2Ynh1Go0j-IqN-T2TbNwo

To claim this, I am signing this object:

@zsiegel
zsiegel / arch_setup.md
Last active Jul 15, 2021
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 May 9, 2020
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 -p ~/.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 + "\"")