Skip to content

Instantly share code, notes, and snippets.

View tacksoo's full-sized avatar

Tacksoo Im tacksoo

  • Georgia Gwinnett College
  • Lawrenceville, GA
View GitHub Profile
@tacksoo
tacksoo / Nondeterministic.java
Last active December 12, 2015 00:19
Simple thread interference example
public class Nondeterministic {
private int x = 0;
private int y = 1;
/*
* What happens when you synchronize only the write()?
* A synchrnoized method is like a bathroom with a door but without walls
*/
@tacksoo
tacksoo / Bank.java
Created February 5, 2013 05:08
Deadlock example caused by a incorrect nested synchronized block.
public class Bank {
private String name;
public Bank(String name) {
this.name = name;
}
public String getName() {
@tacksoo
tacksoo / Consumer.java
Created February 5, 2013 05:51
The famous producer/consumer example
public class Consumer extends Thread {
private IntBuffer buffer;
public Consumer(IntBuffer buffer)
{
this.buffer = buffer;
}
public void run() {
@tacksoo
tacksoo / LinkedListFail.java
Created February 12, 2013 14:50
Example of an ineffective use of the LinkedList
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
public class LinkedListFail {
/*
* This is slow
*/
public static ArrayList<Integer> removeEvensInArrayList(ArrayList<Integer> list) {
@tacksoo
tacksoo / LinkedIntList.java
Created February 14, 2013 06:00
The Practice-IT implementation of a LinkedList
public class LinkedIntList {
private ListNode front;
public LinkedIntList() {
front = null;
}
public int size() {
int count = 0;
@tacksoo
tacksoo / gist:5002643
Last active December 14, 2015 00:59
Data to be used for analysis.
Mr Robert Aaron
Part-time Librarian
faculty-and-staff/robert-aaron
Ms Zaynab Abdul-Razacq
Library Assistant I
faculty-and-staff/zaynab-abdul-razacq
Dr Donna Abrams
Assistant Professor
@tacksoo
tacksoo / Core.java
Created April 9, 2013 13:47
Print out the number of cores
public class Core {
public static void main(String[] args) {
int coreNum = Runtime.getRuntime().availableProcessors();
System.out.println("Number of cores are: " + coreNum);
long maxMemory = Runtime.getRuntime().maxMemory();
System.out.println("MAX size of the heap (MB): " + maxMemory / 1048576);
long freeMemory = Runtime.getRuntime().freeMemory();
@tacksoo
tacksoo / 0_reuse_code.js
Created October 17, 2013 05:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tacksoo
tacksoo / readme.txt
Last active September 6, 2018 17:23
Sample Text file
ferrari california,2019,1000000,FALSE
toyota sienna,2019,50000,FALSE
@tacksoo
tacksoo / emacs.markdown
Created November 19, 2019 21:30 — forked from rochacbruno/emacs.markdown
Emacs and Screen commom keys

emacs

basic

C-g = abort command
C-x C-c = Exit
C-_ | C-x u = Undo
C-z = iconify / %emacs to get back
C-x C-z = suspend, back qith "fg"
M-x shell = bash
ESC-! = shell command