Skip to content

Instantly share code, notes, and snippets.

View shaunburch's full-sized avatar
📱
*beep boop*

Shaun Burch shaunburch

📱
*beep boop*
View GitHub Profile
@shaunburch
shaunburch / hi.md
Last active October 16, 2023 14:31
Hi

Hi

data class User(val name: Stirng)

User("Ben")
@shaunburch
shaunburch / postMac.sh
Created May 20, 2023 17:13
Post eth0 + wlan0 MAC addr to server
#!/bin/bash
# Print MAC addr for eth0 + wlan0
ETH0=$(cat /sys/class/net/eth0/address)
WLAN0=$(cat /sys/class/net/wlan0/address)
# Post to ptsv3.com (set 'xxx' to whatever toilet you want e.g. abc123)
# View at http://ptsv3.com/t/xxx
curl -X POST -H "Content-Type: application/json" \
-d '{ "eth":"'$ETH0'", "wlan0":"'$WLAN0'"}' \
@shaunburch
shaunburch / EventState.kt
Created October 19, 2022 03:29
EventState
/**
* Interface for Unidirectional State Flow via [Event] and [State].
*/
interface EventState<E, S> : Event<E>, State<S>
/**
* Interface for emitting State
*/
interface State<S> {
/**
@shaunburch
shaunburch / Validation.kt
Created February 4, 2022 21:49
An example of input validation pattern
// Foundation
/**
* Validation interface
*/
interface Validation {
fun apply(value: String): ValidationResult
}
/**
@shaunburch
shaunburch / material-light.icls
Created May 20, 2021 18:53
Material theme (light) for Android Studio Logcat
<scheme name="Material - Light" version="142" parent_scheme="Default">
<metaInfo>
<property name="created">2021-05-20T14:51:37</property>
<property name="ide">AndroidStudio</property>
<property name="ideVersion">4.2.1.0</property>
<property name="modified">2021-05-20T14:51:43</property>
<property name="originalScheme">Material - Light</property>
</metaInfo>
<attributes>
<option name="LOGCAT_ASSERT_OUTPUT">
@shaunburch
shaunburch / giffy.sh
Last active June 7, 2024 18:52
Video to GIF
#!/usr/bin/env bash
FILE=$1
ffmpeg -i $FILE -vf fps=10,scale=600:-1 ${FILE%.*}.gif
@shaunburch
shaunburch / prepare-commit-msg
Last active February 21, 2019 16:14
Git hook to prepend branch & issue number to commits
#!/bin/sh
# Author: rmcdaniel
BRANCH_NAME=$(git symbolic-ref --short HEAD)
STORY_NUMBER=$(echo $BRANCH_NAME | sed -n 's/^.*\/\(.*-[0-9]*\)#.*/\1/p')
if [ x != x${STORY_NUMBER} ]; then
sed -i.back "1s/^/$STORY_NUMBER /" "$1"
fi