Skip to content

Instantly share code, notes, and snippets.

Richard Banasiak banasiak

Block or report user

Report or block banasiak

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
@banasiak
banasiak / blc
Last active Aug 29, 2015
Bash script for changing colors using Boblight
View blc
#!/bin/bash
export DISPLAY=:0.0
PID_FILE="/opt/boblight-control/blc.pid"
kill_pid() {
if [ -e "$PID_FILE" ]
then
PID=$(<"$PID_FILE")
View proxy.pac
function FindProxyForURL(url, host)
{
url = url.toLowerCase();
host = host.toLowerCase();
// whole site
var site_list = [
p.ikenex.com
];
View RestDeserializer.java
package com.banasiak.android.example.api.parser;
import com.google.gson.Gson;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import java.lang.reflect.Type;
@banasiak
banasiak / teamspeak
Created Nov 16, 2013
TS3 Upstart Script
View teamspeak
#
# TeamSpeak 3 Server settings
# /etc/default/teamspeak
#
# TS3 install path
TS3_PATH="/opt/teamspeak"
# TS3 binary
TS3_BIN="ts3server_linux_amd64"
View keybase.md

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 / timberm
Last active Mar 24, 2017
Android Studio live code template for logging a method name and its arguments using Timber
View timberm
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
@banasiak
banasiak / ReflectiveToString.java
Last active Oct 5, 2017
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.
View ReflectiveToString.java
/**
* 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 / KotlinEchoServer.kt
Created Nov 23, 2017
An example echo server written in Kotlin.
View KotlinEchoServer.kt
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.net.ServerSocket
import kotlin.concurrent.thread
const val SERVER_PORT = 1337
fun main(args: Array<String>) {
@banasiak
banasiak / DefaultUncaughtExceptionHandler.java
Created Jan 16, 2018
Absolute last chance to log an exception and it's stack trace to logcat for an Android app.
View DefaultUncaughtExceptionHandler.java
public class MyApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
if(BuildConfig.DEBUG) {
final Thread.UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(
(t, e) -> {
Timber.wtf(e);
handler.uncaughtException(t, e);
@banasiak
banasiak / deeplink.sh
Last active Mar 7, 2018
Script to send a deep link to an Android app.
View deeplink.sh
You can’t perform that action at this time.