Skip to content

Instantly share code, notes, and snippets.

@sye8
sye8 / HyperUbuntu.md
Last active July 8, 2021 18:13
Creating an Ubuntu Virtual Machine in HyperV (Windows 10)

Creating an Ubuntu Virtual Machine in HyperV (Windows 10)

Last updated using Ubuntu 18.04.2 (amd64)

0. Pre-requisites

To check if your machine supports Hyper-V, fire up the Command Prompt (cmd.exe) and enter systeminfo.exe

At the end of the output, you will see an entry named Hyper-V Requirements.

@sye8
sye8 / JavaRotatingImage.md
Last active May 12, 2022 18:57
Java Rotating An Image - Graphics2D, KeyListener, Timer

Rotating an Image in Java, Animated

A common idea in video game development is a sprite, which is a 2D image used as a part of the graphics display. For example, Mario and coins are sprites in Super Mario.

If you are thinking about a space shooter, like Asteriod, then you probably need to think about how to rotate the ship, which could be an image.

Assuming that you have a JFrame with a JComponent for drawing set up and an Image of the sprite ready, we will begin.

Insert No Time for Caution by Hans Zimmer

@sye8
sye8 / swift3SelfSignedSSLCert.md
Last active March 26, 2024 18:45
Swift 3 Trusting a Self-Signed SSL Certificate

Swift 3 Trusting a Self-Signed SSL Certificate

For testing purposes, we may want to have local testing servers using self-signed SSL certificate for HTTPS connection. Now, suppose we have a local server with self-signed certificate, establishing an actual HTTPS connection would require us to trust our self-signed certificate. It is easy on a browser: few clicks, and you will be on your way. But how about a Swift application?

Caution: Get an actual, trusted, signed certicate for production apps!

0. A regular HTTPS request

App Transport Security (ATS) is a technology that requires an app to either support best practice HTTPS security or statically declare its security limitations via a property in its Info.plist.

@sye8
sye8 / openssl-self-signed.md
Last active August 1, 2018 10:01
Generating Self-Signed Certificate Using OpenSSL + Applying to Tomcat 7

Generating Self-Signed Certificate Using OpenSSL + Applying to Tomcat 7

For testing purposes, we may want to have local testing servers using self-signed SSL certificate for HTTPS connection. Here is how to generate self-signed certificate using OpenSSL from Terminal, and apply it to a tomcat 7 server.

Installation Note:

  • For MacOS: Type brew install openssl in Terminal (If you don't have Homebrew, check it out here)

  • For Linux with apt-get: Type sudo apt-get install openssl

@sye8
sye8 / ObtainingResults.md
Last active December 11, 2020 14:27
Research Kit + Apple Watch Tutorial (Swift 3) - Part 3: Displaying the Results as a chart + Send via HTTP
@sye8
sye8 / HeartRateTask.md
Last active January 24, 2024 14:19
Research Kit + Apple Watch Tutorial (Swift 3) - Part 2: Creating a Heart Rate Task + Heart Rate with Apple Watch
@sye8
sye8 / ResearchKitConsent.md
Last active December 11, 2020 14:28
Research Kit + Apple Watch Tutorial (Swift 3) - Part 1: Obtaining Consent and Generating PDF
@sye8
sye8 / Graphs.md
Last active July 10, 2019 12:06
CSC 172 Graph Implementation

Graphs (Suggestions for Implementation in Java)

Yep. Fun stuff

Well, I mean...If you think about it, linked lists and trees are all graphs, with special properties

IMPORTANT: If you are not really familiar with graphs, please refer to Chapter 10 of Discrete Mathematics And Its Applications 7th Edition by Kenneth H. Rosen

The content below will mainly talk about implementation, instead of theory. Make sure you are familiar with the theory part before moving on!

@sye8
sye8 / HuffmanProjectIO.md
Last active March 19, 2019 02:59
CSC 172 Project 3 I/O

First: Read BinaryIn.java and BinaryOut.java about their methods before reading on!

Otherwise you won't know what is going on!

Note: This will vary between your implementations, and the following are just suggestions!

BinaryIn

Just like Java's Scanner, you would first need to construct a new instance of the BinaryIn (I suppose you know that already)

@sye8
sye8 / JavaFunctionalInterface.md
Last active February 2, 2018 00:54
CSC 172 Lab Java Functional Interface

Note on Java Functional Interface

If you read this, and still don't understand what is the syntax, read on:

A Java Function is like a method, but is more powerful than a method. For the purpose of this lab, you would only need to know that a fucntion, is like a method.

At the meantime, a Function is an Object (instance of a class), and so to start coding up your Function, you need to declare a Function, just like any other Object.

When you declare an Object, you do this: