Skip to content

Instantly share code, notes, and snippets.

View rendyananta's full-sized avatar

Rendy Ananta rendyananta

View GitHub Profile
#!/bin/bash
apt-get update
apt-get install -y nginx
service nginx start
HOSTNAME=$(cat /proc/sys/kernel/hostname)
sed -i -- 's/nginx/Google Cloud Platform - '"\$HOSTNAME"'/' /var/www/html/index.nginx-debian.html
@rendyananta
rendyananta / TaylorSeries.java
Last active February 18, 2019 04:03
App to calculate sin cos tan using taylor series
import java.util.Scanner;
public class TaylorSeries {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("=============== TaylorSeries Series Calculation App ===============");
System.out.print("Enter the number you want to calculate (in radian): ");
@rendyananta
rendyananta / TemperatureConverter.java
Last active February 18, 2019 04:12
App to convert temperature
import java.util.Scanner;
public class TemperatureConverter {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("=========== Temperature Converter App ===========");
System.out.println("What type of temperature you want to convert from : ");
showMenu();
@rendyananta
rendyananta / Factorial.java
Created February 18, 2019 03:59
App to calculate factorial of x
import java.util.Scanner;
public class Factorial {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Calculate factorial of: ");
System.out.println("The factorial is : " + factorial(scanner.nextInt()));
}
@rendyananta
rendyananta / docker-compose.yml
Created February 6, 2019 02:45
poste.io docker-compose file
version: '3'
servives:
image: analogic/poste.io
ports:
- 25:25
- 2525:80
- 110:110
- 143:143
- 465:465
- 587:587
@rendyananta
rendyananta / DayCountDownIf.java
Last active January 13, 2019 10:16
Day Reverse Counting
import java.util.Scanner;
public class DayCountDownIf {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String[] days = { "Senin", "Selasa", "Rabu", "Kamis", "Jum'at", "Sabtu", "Minggu" };
@rendyananta
rendyananta / triangle_looping.java
Created January 2, 2019 06:03
Show Triangle from user input
class Main {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
int number = scanner.nextInt();
for (int i = 1; i <= number; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(j);
@rendyananta
rendyananta / looping_determine_prime_number.java
Created January 2, 2019 05:51
Simple script to determine input number is a prime or not
class Main {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
int number = scanner.nextInt();
int factorCount = 0;
for (int i = 0; i <= number; i++) {
if (number % i == 0) {
// Bahasa Indonesia
val daftar = arrayOf(1, 2, 3, 4, 5)
for (i in 0 until daftar.size) {
print(daftar.get(i)) // 12345
}
// English
val list = arrayOf(1, 2, 3, 4, 5)
for (i in 0 until list.size) {
// don't
val a = 10
val b = 19
val c = 22
if (a > b) {
println(a)
} else {
println(b)
}