Skip to content

Instantly share code, notes, and snippets.

View racecraftr's full-sized avatar
💭
neutral

Avi Gupta racecraftr

💭
neutral
View GitHub Profile
@racecraftr
racecraftr / printAscii.go
Last active February 23, 2023 23:22
prints out a jpeg/png image as an ASCII .txt file. Play around with it a bit :D
package main
import (
"bufio"
"fmt"
"image"
"image/png"
"image/jpeg"
"io"
"os"
# Variables and Lists
# ===================
board = [
[" ", " ", " "],
[" ", " ", " "],
[" ", " ", " "]
]
playing = True
# Functions
@racecraftr
racecraftr / Day18.java
Created June 24, 2022 14:13
Day 18 of the Useless Java series.
package UselessJava.Day18;
public class Day18 {
public String detectCosmicRay(){
final String[] comments = {"Why are you still here?",
"Most systems automatically fix errors caused by cosmic rays.",
"This is so stupid.",
"Based off of a reddit post by u/TripplerX.",
"I did nawt kill her, I did naaawt! Oh hai Mark.",
"The cheese stands alone, so sad :(",
@racecraftr
racecraftr / Day17.java
Created June 23, 2022 15:32
Day 17 of the useless Java series.
package UselessJava.Day17;
import java.util.Scanner;
public class Day17 {
public String generateCheckerboard(int size){
return generateCheckerboard(size, size);
}
@racecraftr
racecraftr / Day16.java
Created June 22, 2022 21:59
Day 16 of the Useless Java series.
package UselessJava.Day16;
import java.util.Scanner;
public class Day16 {
public long sumOfString(String s){
long sum = 0;
String[] strings = s.split("\\D");
for(String string : strings) {
if(string.length() > 0) {
@racecraftr
racecraftr / Day15.java
Created June 21, 2022 15:23
Day 15 of the Useless Java series.
package UselessJava.Day15;
import java.util.Scanner;
public class Day15 {
public boolean hasHiddenRickRoll(String s){
String test = s.replaceAll("[ \\t\\n]", "");
String rickroll = "nevergonnagiveyouup";
String regex = ".*";
for(int i = 0; i < rickroll.length(); i++) {
@racecraftr
racecraftr / Day14.java
Created June 20, 2022 19:59
Day 14 of the useless Java Series
package UselessJava.Day14;
import java.util.Scanner;
public class Day14 {
public String sortString(String s){
char[] chars = s.toCharArray();
quickSort(chars);
return String.valueOf(chars);
}
@racecraftr
racecraftr / Day13.java
Created June 20, 2022 01:49
Day 13 of the Useless Java series.
package UselessJava.Day13;
import java.util.Scanner;
public class Day13 {
public String decimalToFraction(double x){
if(x == 0) return "0";
if(x == (long)x) return Long.toString((long)x);
double n = Math.abs(x);
long d = 1;
@racecraftr
racecraftr / Day12.java
Created June 18, 2022 17:14
Day 12 of the useless Java series.
package UselessJava.Day12;
import java.util.Scanner;
public class Day12 {
public String scared(String s){
String[] strings = s.split("[ \\t\\n]");
String res = "";
for(String string : strings) {
double n = Math.random();
package UselessJava.Day11;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.Scanner;
public class Day11 {