Skip to content

Instantly share code, notes, and snippets.

View ed-george's full-sized avatar
🌍
Working remotely...

Ed Holloway-George ed-george

🌍
Working remotely...
View GitHub Profile
@ed-george
ed-george / cleanup
Created March 31, 2014 19:05
Clean folder by moving all files not appended with underscore to Trash (Mac Only)
ls -1 | grep -v '^_' | xargs -I '{}' mv {} ~/.Trash
@ed-george
ed-george / wii_connect.py
Created April 19, 2014 13:16
Initial test script with Bluetooth/GPIO
#!/usr/bin/python
#
# === pi-Racey ===
#
# wii_connect.py
# Connect a Nintendo Wii Remote via Bluetooth
# to drive a remote control car through GPIO
#
# Project URL :
# http://ed-george.github.io/piRacey/
@ed-george
ed-george / AsyncResponse.java
Created July 5, 2014 09:07
Async Callback Example
/**
* @author edgeorge
*
*/
public interface AsyncResponse {
void onProcessFinish(String result, int id);
}
@ed-george
ed-george / morse.ino
Created September 5, 2014 16:13
Arduino Morse with dual color LED
#define GREEN_LED 8
#define RED_LED 12
#define DOT '.'
#define DASH '-'
#define PIN_DELAY 500
char *ascii = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,?'!/()&:;=+-_\"$@";
char *code[] = {
".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--..","-----",".----","..---","...--","....-",".....","-....","--...","---..","----.",".-.-.-","--..--","..--..",".----.","-.-.--","-..-.","-.--.","-.--.-",".-...","---...","-.-.-.","-...-",".-.-.","-....-","..--.-",".-..-.","...-..-",".--.-."
@ed-george
ed-george / OptimizeImage.java
Created May 26, 2015 14:52
Image compression script using online service - TinyPNG
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.io.File;
import javax.xml.bind.DatatypeConverter;
@ed-george
ed-george / AppBarStateChangedListener.java
Last active July 13, 2022 12:05
Simple listener to determine if the AppBarLayout of a view is collapsed or expanded
public abstract class AppBarStateChangedListener implements AppBarLayout.OnOffsetChangedListener {
public enum State {
EXPANDED,
COLLAPSED,
IDLE
}
private State mCurrentState = State.IDLE;
@ed-george
ed-george / FadeInNetworkImageView.java
Created March 29, 2016 11:30 — forked from benvd/FadeInNetworkImageView.java
Extension of Volley's NetworkImageView that fades in images as they're loaded
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.*;
import android.util.AttributeSet;
import com.android.volley.toolbox.NetworkImageView;
public class FadeInNetworkImageView extends NetworkImageView {
private static final int FADE_IN_TIME_MS = 250;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
import android.util.AttributeSet;
@ed-george
ed-george / fix_versioning_tags.sh
Last active April 9, 2018 19:07
A simple script for finding non-v.X.Y.Z tags in a repository, renaming and replacing them
#!/bin/bash
# A simple dumb tag clean-up utility that appends a 'v' to non X.Y.Z tags stored locally and remotely
# Written with love by Ed George - [email protected]
# =========== =========== ===========
# Constants
# =========== =========== ===========
# Reset
@ed-george
ed-george / party-gif-creator.sh
Created July 18, 2018 16:01
Create a party gif using a black template image (requires ImageMagick)
#! /bin/bash
# Pass image as first param
IMAGE=$1
# Declare array
declare -a color=("rgb(66,0,69)" "rgb(0,137,60)" "rgb(0,118,137)" "rgb(14,0,49)" "rgb(200,76,23)")
# For each color, create a recolored version of the all black template
for i in "${!color[@]}"; do