Skip to content

Instantly share code, notes, and snippets.

@tarrsalah
tarrsalah / App.java
Last active September 12, 2024 14:06
Visualize the contents of a text file in JavaFX TextArea.
package org.tarrsalah.fileReader;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
* App.java (UTF-8)
@tarrsalah
tarrsalah / Dead.java
Created August 25, 2013 10:29
a Dead lock example
public class Dead {
private int state;
public Dead(int state) {
this.state = state;
}
public synchronized int getMyState() {
@tarrsalah
tarrsalah / SOExample.java
Created August 25, 2013 09:49
Fuck the jvm.
public class SOExample {
private int state = 0;
public int getAndIncrement() {
return state++;
}
public int getAndIncrementAnother(SOExample dle) {
return dle.getAndIncrement() + dle.getAndIncrementAnother(this);
@tarrsalah
tarrsalah / ShakingStage.java
Created May 20, 2013 18:59
The ShakingStage.
import javafx.animation.KeyFrame;
import javafx.animation.RotateTransitionBuilder;
import javafx.animation.Timeline;
import javafx.animation.TimelineBuilder;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.SceneBuilder;
import javafx.scene.control.Button;
@tarrsalah
tarrsalah / PathDrawing.java
Last active December 17, 2015 12:09
Images and Snapshots 2 in 1.
/**
* Created with IntelliJ IDEA.
* User: tarrsalah
* Date: 5/19/13
* Time: 2:25 PM
* To change this template use File | Settings | File Templates.
*/
import java.awt.*;
#!/bin/bash
#
# pickjdk: provides a shell function that allows you to choose a JDK.
#
# The function sets JAVA_HOME and PATH On Linux or
# Windows, just set the environment variable JDKS_ROOT to the directory
# containing multiple versions of the JDK and the function will prompt you to
# select one. On OSX, JDKs will be discovered for you.
# JDKS_ROOT=/opt/jdk
@tarrsalah
tarrsalah / path.sh
Created May 10, 2013 13:34
Print $PATH
function path(){
old=$IFS
IFS=:
printf "%s\n" $PATH
IFS=$old
}
import java.sql.*;
import java.util.logging.*;
import javafx.application.Application;
import javafx.collections.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
@tarrsalah
tarrsalah / 256.sh
Created May 5, 2013 14:13
Print 256 colours.
for i in {0..255} ; do
printf "\x1b[38;5;${i}mcolour${i}\n"
done
@tarrsalah
tarrsalah / SimpleListView.java
Last active August 15, 2021 17:05
Simple Editable javafx ListView.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.ListView;