Skip to content

Instantly share code, notes, and snippets.

View AndyQ's full-sized avatar

Andy Qua AndyQ

View GitHub Profile
@AndyQ
AndyQ / speak.sh
Created January 28, 2014 15:57
OSX Speak a phrase with all the default voices
#!/bin/bash
text=$1
if [[ "$text" == "" ]]; then
text="Hello World"
fi
echo "Female"
for voice in Agnes Kathy Princess Vicki Victoria; do
echo $voice
say -v $voice $text
/*
Scrolling text display for YFRobot 8x8 Dot Matrix display (controller with dual serial 74HC595 chips)
Author: Andy Qua
Date: 26th April 2015
*/
int dataPin = 10; // The Serial Data Pin to the Shift Register (SER on board)
int latchPin = 8; // The Latch Pin to the Shift Register (RCK on board)
int clockPin = 7; // The Clock Pin to the Shift Register (SRCK on board)

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@AndyQ
AndyQ / conrec.js
Created January 18, 2019 08:53 — forked from sdowsland/conrec.js
/**
* Copyright (c) 2010, Jason Davies.
*
* All rights reserved. This code is based on Bradley White's Java version,
* which is in turn based on Nicholas Yue's C++ version, which in turn is based
* on Paul D. Bourke's original Fortran version. See below for the respective
* copyright notices.
*
* See http://local.wasp.uwa.edu.au/~pbourke/papers/conrec/ for the original
* paper by Paul D. Bourke.
@AndyQ
AndyQ / MRDMenuView.h
Created March 1, 2020 17:48 — forked from steventroughtonsmith/MRDMenuView.h
Simplified iOS menu view wired up to UIMenuBuilder
//
// MRDMenuView.h
// MobileRadio
//
// Created by Steven Troughton-Smith on 29/02/2020.
// Copyright © 2020 High Caffeine Content. All rights reserved.
//
#import <UIKit/UIKit.h>
//
// MRDMenuView.h
// MobileRadio
//
// Created by Steven Troughton-Smith on 29/02/2020.
// Copyright © 2020 High Caffeine Content. All rights reserved.
//
#import <UIKit/UIKit.h>
@AndyQ
AndyQ / SelectableRoundedBorderView.swift
Created May 17, 2021 11:02
Simple SwiftUI view that draws a bordered rounded rectangle that allowes you to pick which corner is rounded and also allow borders to be not show if both corners on a side are not rounded
struct ContentView: View {
var body: some View {
Color.clear
.foregroundColor(.white)
.frame( width:100, height:100)
.font(.largeTitle)
.padding(20)
.background(RoundedCorners(color: .blue, tl: 10, tr: 0, bl: 10, br: 0, left:true, right:false))
}
}
@AndyQ
AndyQ / gist:6bf57790e63e3f47965678971c463226
Created January 22, 2022 16:35
Simple image display for YFRobot 8x8 Dot Matrix display (controller with dual serial 74HC595 chips)
/*
Simple image display for YFRobot 8x8 Dot Matrix display (controller with dual serial 74HC595 chips)
Author: Andy Qua
Date: 22nd Jan 2022
*/
int dataPin = 10; // The Serial Data Pin to the Shift Register (SER on board)
int latchPin = 8; // The Latch Pin to the Shift Register (RCK on board)
int clockPin = 7; // The Clock Pin to the Shift Register (SRCK on board)
@AndyQ
AndyQ / Resize.swift
Created January 4, 2023 14:08
UIImage extension in Swift to resize images
import ImageIO
import Accelerate
extension UIImage {
public enum ResizeFramework {
case uikit, coreImage, coreGraphics, imageIO, accelerate
}
/// Resize image with ScaleAspectFit mode and given size.