This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Sanity checks | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
#Abort if no git/puppet | |
command -v git >/dev/null 2>&1 || { echo "I require git but it's not installed. Please install git-core if on debian/ubuntu" >&2; exit 1; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BeanCounter { | |
public static void main(String[] args) { | |
final int BEANS = 1000; | |
int[] buckets = new int[8]; | |
int pointer = 0; | |
for(int i=0;i<BEANS;i++){ | |
for(int level=0;level<9;level++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BrutePrime { | |
public static void main(String[] args) { | |
final int END_VALUE = 1000000; | |
for(int number=2;number<END_VALUE;number++){ | |
boolean isPrime = true; | |
//check divisors to see isPrime | |
for(int divisor=2;divisor<number;divisor++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Connect4 { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
char[][] grid = new char[6][7]; | |
//initialize array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Emirp { | |
public static boolean isPrime(int number){ | |
for (int divisor = 2;divisor < number;divisor++){ | |
if(number % divisor == 0){ | |
return false; | |
} | |
} | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
import java.util.Arrays; | |
public class IntRange { | |
public static double range(double[] numbers){ | |
Arrays.sort(numbers); | |
double result = numbers[numbers.length-1] - numbers[0]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class IntReverse { | |
public static void main(String[] args) { | |
final int TOTAL_INTS = 10; | |
Scanner input = new Scanner(System.in); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.NumberFormat; | |
import java.util.Scanner; | |
public class Payroll { | |
public static void main(String[] args) { | |
System.out.print("Employee's Name: "); | |
Scanner input = new Scanner(System.in); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Minutes2Years { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
System.out.print("Enter the number of minutes: "); | |
Scanner input = new Scanner(System.in); | |
int minutes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Feet2Meters { | |
public static void main(String[] args) { | |
System.out.print("Enter distance in feet (ft): "); | |
Scanner input = new Scanner(System.in); | |
double feet; | |
feet = input.nextDouble(); |
OlderNewer