Skip to content

Instantly share code, notes, and snippets.

View banasiak's full-sized avatar

Richard Banasiak banasiak

View GitHub Profile
private class DebugModeTapListener implements View.OnClickListener {
private int tapCount = 0;
private long lastTap = SystemClock.elapsedRealtime();
@Override
public void onClick(final View v) {
final Context context = getApplicationContext();
long currentTap = SystemClock.elapsedRealtime();
if (currentTap - lastTap < 500) {
@banasiak
banasiak / DefaultKeyBindings.dict
Last active October 29, 2018 23:01 — forked from Jimbly/DefaultKeyBindings.dict
Mac OSX keybindings to more closely match Windows
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more closely
match default behavior on Windows systems.
You must log out and back in to see these changes.
Here is a rough cheatsheet for syntax.
Key Modifiers
^ : Ctrl
$ : Shift
@banasiak
banasiak / update-digitial-ocean-dns.sh
Created September 13, 2018 14:37 — forked from kenmickles/update-digitial-ocean-dns.sh
Shell script to dynamically update a Digital Ocean DNS record
#!/bin/bash
TOKEN="Get token from https://cloud.digitalocean.com/settings/applications"
DOMAIN=example.com
RECORD_ID=12345
IP=`curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+'`
# to get record id:
# curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" "https://api.digitalocean.com/v2/domains/$DOMAIN/records"
#!/bin/sh
echo "Formatting code..."
./gradlew googleJavaFormat formatKotlin --daemon
status=$?
if [ "$status" = 0 ]; then
echo "Formatting complete - adding files to Git"
git add .
exit 0
@banasiak
banasiak / 10-monitor.conf
Created March 11, 2018 02:36
Dell XPS 15 4K Monitor Resolutions (Fedora)
Section "Monitor"
Identifier "eDP-1"
Modeline "3840x2160_60.00" 712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync
Modeline "2560x1440_60.00" 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync
Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
Option "PreferredMode" "2560x1440_60.00"
EndSection
Section "Screen"
Identifier "Screen0"
@banasiak
banasiak / deeplink.sh
Last active March 7, 2018 18:18
Script to send a deep link to an Android app.
@banasiak
banasiak / ReflectiveToString.java
Last active October 5, 2017 17:06
Create a string representation of an object. This will include all fields that are not transient or static. The returned string will be in the form of `full_class_name{fieldName='value'}` This will also include all super types values as well in the string.
/**
* Create a string representation of an object. This will include all fields that are not
* transient or static. The returned string will be in the form of `full_class_name{fieldName='value'}`
* This will also include all super types values as well in the string.
*
* @param object The object to get a string representation from.
* @return String representation of the object.
*/
public static String toString(Object object) {
Class<?> aClass = object.getClass();
@banasiak
banasiak / timberm
Last active March 24, 2017 20:25
Android Studio live code template for logging a method name and its arguments using Timber
Timber.d($content$);
content:
groovyScript("def params = _2.collect {it + ' = [%s]'}.join(', '); def params2 = _2.collect {it}.join(', '); return '\"' + _1 + '() called' + (params.empty ? '' : ' with: ' + params) + '\"' + (params2.empty ? '' : ', ' + params2)", methodName(), methodParameters())
Applicable in Java: statement

Keybase proof

I hereby claim:

  • I am banasiak on github.
  • I am banasiak (https://keybase.io/banasiak) on keybase.
  • I have a public key ASAtGYlAVxLbw5TUVjCfsntUqX9FE5y6u0BeQYjWx8Op0wo

To claim this, I am signing this object:

@banasiak
banasiak / teamspeak
Created November 16, 2013 20:57
TS3 Upstart Script
#
# TeamSpeak 3 Server settings
# /etc/default/teamspeak
#
# TS3 install path
TS3_PATH="/opt/teamspeak"
# TS3 binary
TS3_BIN="ts3server_linux_amd64"