Skip to content

Instantly share code, notes, and snippets.

View ChaosLeung's full-sized avatar

Chaos ChaosLeung

View GitHub Profile
@ChaosLeung
ChaosLeung / accessors.sh
Last active December 24, 2021 01:57
Modified version helper scripts base from "Exploring Java Hidden Costs" presentation.
#!/bin/bash
set -e
METHODS=$(diffuse members --methods $1 | \grep 'access\$')
ACCESSORS=$(echo "$METHODS" | wc -l | xargs)
METHOD_AND_READ=$(echo "$METHODS" | egrep 'access\$\d+00\(' | wc -l | xargs)
WRITE=$(echo "$METHODS" | egrep 'access\$\d+02\(' | wc -l | xargs)
PREINC=$(echo "$METHODS" | egrep 'access\$\d+04\(' | wc -l | xargs)
PREDEC=$(echo "$METHODS" | egrep 'access\$\d+06\(' | wc -l | xargs)
POSTINC=$(echo "$METHODS" | egrep 'access\$\d+08\(' | wc -l | xargs)
@ChaosLeung
ChaosLeung / git.plugin.zsh
Created December 9, 2017 02:10
For linux
#!/bin/sh
#
# Functions
#
# The name of the current branch
# Back-compatibility wrapper for when this function was defined here in
# the plugin, before being pulled in to core lib/git.zsh as git_current_branch()
# to fix the core -> git plugin dependency.
function git_current_branch() {