Skip to content

Instantly share code, notes, and snippets.

Avatar

Tankery tankery

View GitHub Profile
@tankery
tankery / met_calc.js
Created Jul 26, 2018
MET Calculator for Google Sheet Function
View met_calc.js
function MET(type, speed) {
var STANDING_QUIETLY = 1.3;
var WALK_MET_TABLE = [
[5.0 * 1.6, 8.3], // 5.0 mph, 8.3 METs
[4.5 * 1.6, 7.0], // 4.5 mph, 7.0 METs
[4.0 * 1.6, 5.0], // 4.0 mph, 5.0 METs
[3.5 * 1.6, 4.3], // 3.5 mph, 4.3 METs
[2.5 * 1.6, 3.0], // 2.5 mph, 3.0 METs
@tankery
tankery / color_defs.sh
Created Jul 11, 2018
Bash text color definitions
View color_defs.sh
# Reset
Color_Off='\033[0m' # Text Reset
# Regular Colors
Color_Black='\033[0;30m' # Black
Color_Red='\033[0;31m' # Red
Color_Green='\033[0;32m' # Green
Color_Yellow='\033[0;33m' # Yellow
Color_Blue='\033[0;34m' # Blue
Color_Purple='\033[0;35m' # Purple
@tankery
tankery / submit-latest.sh
Last active Jul 11, 2018
Submit latest git commit
View submit-latest.sh
#!/bin/bash
# Submit latest git commit.
# Usage:
# submit-latest.sh [topic]
#
# Reset
Color_Off='\033[0m'
# Regular Colors
@tankery
tankery / AndroidBuildFields.java
Last active Feb 12, 2018
Show Android Build fields
View AndroidBuildFields.java
for (Field field : Build.class.getFields()) {
try {
if (field.getType().isAssignableFrom(String.class)) {
Timber.d("%16s: %s", field.getName(), field.get(null));
}
} catch (IllegalAccessException e) {
Timber.w(e, "Failed to print %s", field.getName());
}
}
@tankery
tankery / PCMEncoder.java
Last active Nov 17, 2017
Encode PCM stream into MP4 file stream
View PCMEncoder.java
package me.tankery.mediabox.encoder;
import android.annotation.SuppressLint;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
View C++ Header Guard.sublime-snippet
<snippet>
<description>ifndef (…)</description>
<content><![CDATA[#ifndef $1
#define ${1:${TM_FILEPATH/(([A-Za-z]+)\/((inc)|(include)|(src)|(source))\/)|./\U(?1:$2_)\E/g}${TM_FILENAME/(([A-Z])([A-Z][a-z]))|(([a-z])([A-Z]))|([a-z])|(\.)/\U(?1:$2_$3)(?4:$5_$6)$7(?8:_)\E/g}}
${0:$SELECTION}
#endif // $1
]]></content>
You can’t perform that action at this time.