Skip to content

Instantly share code, notes, and snippets.

@imryan
imryan / Prime.java
Last active December 26, 2015 11:09
Prime number calculator.
import java.util.Scanner;
public class Prime {
public static void main(String[] args) {
// Declare a new Scanner object and an integer
Scanner sc = new Scanner(System.in);
int n = 0;
@imryan
imryan / Leap.java
Last active December 26, 2015 21:49
Determines leap years.
import java.util.Scanner;
public class Leap {
public static void main(String[] args) {
// Call menu method
menu();
}
@imryan
imryan / Number.java
Created October 30, 2013 16:50
Determines odd/even/zeros in a numerical value.
import java.util.Scanner;
public class Numbers
{
public static void main(String[] args)
{
// Declare variables
Scanner sc = new Scanner(System.in);
int evens = 0, odds = 0, zeros = 0;
int number = 0;
@imryan
imryan / Bottles.java
Last active December 27, 2015 00:18
Bottles of soda on the wall, since beer is bad.
import java.util.Scanner;
public class Bottles
{
public static void main(String[] args)
{
// Declare variables
Scanner sc = new Scanner(System.in);
int verses = 0;
@imryan
imryan / Tax.java
Last active December 28, 2015 16:39
CS 2 test. Calculates tax rate based on income.
import java.util.*;
import java.text.*;
public class Tax {
public static void main(String[] args) {
// Declare double values to be used in the program
double income = 0;
String taxRate = "";
@imryan
imryan / Coinflip.java
Created November 20, 2013 16:18
Coinflip program that was extremely necessary to complete.
import java.util.*;
public class Coinflip {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int sideNo = 0;
String side = "";
String landedSide = "";
@imryan
imryan / eject.py
Last active December 30, 2015 08:49
Opens and closes disk tray infinitely.
import ctypes
def eject():
opens = 0
closes = 0
while (True):
# Open disk tray
ctypes.windll.WINMM.mciSendStringW(u"open D: type cdaudio alias d_drive", None, 0, None)
@imryan
imryan / greet.js
Created December 25, 2013 18:56
Simple Merry Christmas script.
function greet() {
var sleep = require('sleep');
var letters = [ "M", "E", "R", "R", "Y", " ",
"C", "H", "R", "I", "S", "T", "M", "A", "S" ];
for (var i = 0; i < letters.length; i++) {
sleep.usleep(100900);
process.stdout.write(letters[i] + " ");
}
}
@imryan
imryan / Calc.java
Created January 7, 2014 17:51
CLI calculator that performs computations on one line.
import java.text.NumberFormat;
import java.util.Locale;
import java.util.Scanner;
public class ConsoleCalc {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String line = sc.nextLine();

Keybase proof

I hereby claim:

  • I am imryan on github.
  • I am imryan (https://keybase.io/imryan) on keybase.
  • I have a public key whose fingerprint is 9852 C9DD 92B9 B250 F4C3 0F02 E52E 50E8 A287 ECF4

To claim this, I am signing this object: