Skip to content

Instantly share code, notes, and snippets.

View mepcotterell's full-sized avatar
💭
I may be slow to respond.

Michael Cotterell mepcotterell

💭
I may be slow to respond.
View GitHub Profile
{
"@context": "https://schema.org/docs/jsonldcontext.json",
"@graph": [
{
"@id": "#issue4",
"@type": "PublicationIssue",
"datePublished": "2006-10",
"issueNumber": "4"
},
{
.rendered_html .text-muted {
color: #6c757d!important;
}
.rendered_html .lead {
font-size: 1.25rem;
font-weight: 300;
}
.rendered_html h1 a.anchor-link {
.bd-callout-info {
border-left-color: #5bc0de;
}
.bd-callout {
padding: 1.25rem;
margin-top: 1.25rem;
margin-bottom: 1.25rem;
border: 1px solid #eee;
border-left-width: .25rem;

Setup Oracle JDK 8 on MacOS

  1. Download the .dmg file for "macOS x64" here. Due to licensing, you will need to login to start the download. Creating an account is free.

  2. Install the JDK on your system by double clicking the .dmg file, then running the installer.

Unit of Least Precision (ULP) in Java

Double

double ulp1 = Math.ulp(1.0);
double ulp1 = Double.longBitsToDouble(971l << 52);
bin/
doc/
target/
*.class
hs_err_pid*
*~
\#*\#
core.*
package cs1302.example;
import java.util.Queue;
import java.util.ArrayDeque;
import java.util.PriorityQueue;
/**
* Interface example app.
* @see https://docs.oracle.com/javase/8/docs/api/java/util/Queue.html
* @see https://docs.oracle.com/javase/8/docs/api/java/util/ArrayDeque.html
@mepcotterell
mepcotterell / README.md
Last active July 27, 2022 02:09
Implementing a Semaphore

Implementing a Semaphore

Use the following commands to compile and link the examples:

$ gcc -std=c17 -pedantic-errors -O0 -g -S sem.c
$ as --gstabs -o sem.o sem.s 
$ gcc -o sem sem.o -lpthread

This implementation makes use of the C11 Atomic Operations Library.

@mepcotterell
mepcotterell / README.md
Last active March 5, 2023 17:06
Implementing a Mutex

Implementing a Mutex

Use the following commands to compile and link the examples:

$ gcc -std=c17 -pedantic-errors -O0 -g -S mutex.c
$ as --gstabs -o mutex.o mutex.s 
$ gcc -o mutex mutex.o -lpthread

This implementation makes use of the C11 Atomic Operations Library.

@mepcotterell
mepcotterell / README.md
Last active August 17, 2019 14:26
Critical Section Problem

Critical Section Problem

Use the following commands to compile and link the examples:

$ gcc -std=c17 -pedantic-errors -O0 -g -o problem problem.c -lpthread
$ gcc -std=c17 -pedantic-errors -O0 -g -o peterson0 peterson0.c -lpthread