Skip to content

Instantly share code, notes, and snippets.

View xaethos's full-sized avatar

Diego Garcia xaethos

View GitHub Profile
@xaethos
xaethos / fly-edit-pipeline
Created September 6, 2016 03:43
Bash script to fetch, edit, and write back a Concourse pipeline
#!/bin/bash
set -euo pipefail
TARGET=${1:-}
PIPELINE=${2:-}
FLY=$(which fly)
TEMPDIR=$(mktemp -d -t concourse)
cleanup() {
@xaethos
xaethos / FooCommand.java
Last active June 23, 2016 03:57
Injectable PureMVC commands
package com.example;
import android.os.Bundle;
import android.support.annotation.VisibleForTesting;
import org.puremvc.java.interfaces.INotification;
import org.puremvc.java.patterns.command.SimpleCommand;
import org.puremvc.java.patterns.facade.Facade;
import javax.inject.Inject;

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@xaethos
xaethos / logtag
Created February 11, 2016 03:26
Set the Android log level for a tag
#!/bin/sh
# Basic script for setting the log level for an Android tag
# Usage: logtag tagname [loglevel]
# Will default to VERBOSE logging
cmd="adb shell setprop log.tag.${1:?Must provide a tag} ${2:-VERBOSE}"
echo $cmd
$cmd
@xaethos
xaethos / ExpandTextActivity.java
Created June 24, 2015 04:12
Expandable text view
package net.xaethos.sandbox.expand;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
@xaethos
xaethos / gist:31aac29b77b7f07de285
Last active August 29, 2015 14:21
Print certificate info for Android APK
function apk_printcert {
unzip -p "$1" META-INF/CERT.RSA | keytool -printcert
}
@xaethos
xaethos / uob2csv.py
Last active July 16, 2017 03:28
UOB activity spreadsheet to CSV
#!/usr/bin/env python3
import sys
import xlrd
import csv
from datetime import datetime
skip = [
'Funds Trf - FAST',
'Inward CR - GIRO',
@xaethos
xaethos / gist:6163374
Last active December 20, 2015 16:39
Convert as_json hash to controller params, for testing ease
def to_form_param json
case json
when Array
return json if json.empty? || !json[0].is_a?(Hash)
i = 0
json.reduce({}.with_indifferent_access) do |memo, item|
memo["#{i}"] = to_form_param item
i += 1
memo
end
@xaethos
xaethos / spin.vim
Created March 19, 2013 08:24
Command for using Spin from Vim :Spin path/to/spec # spin push file :Spin # spin push current file :.Spin # spin push current line
function Spin(count, ...)
let cmd = '!spin push'
if a:0 > 0
for f in a:000
let cmd = cmd . ' ' . f
endfor
else
let cmd = cmd . ' %:' . a:count
endif
@xaethos
xaethos / gist:3792258
Created September 27, 2012 05:06
Mocking HttpURLConnection
public class URLRequestUnit extends InstrumentationTestCase
{
private static final String API_URL =
"http://www.example.com/api/users";
public void testHttpOkay() throws Exception {
MockURLStreamHandler handler = new MockURLStreamHandler();
URL.setURLStreamHandlerFactory(handler);
UsersRequest request = new UsersRequest();