Skip to content

Instantly share code, notes, and snippets.

View TheBlackPlague's full-sized avatar
💭
I'm working on two big projects.

Shaheryar Sohail TheBlackPlague

💭
I'm working on two big projects.
  • Pittsburgh, US
View GitHub Profile
import java.util.Scanner;
public class GradeCalculator {
public static void main(String[] args) {
try (Scanner input = new Scanner(System.in)) {
while (true) {
System.out.print("Please enter your grade: ");
double grade = input.nextDouble();
@TheBlackPlague
TheBlackPlague / LargeFibonacci.java
Created March 21, 2022 16:00
Some Java code to calculate large fibonacci numbers.
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import java.math.BigInteger;
public class LargeFibonacci {
public static void main(String[] args) {
BigInteger x = new BigInteger("0");
BigInteger y = new BigInteger("1");
def b_to_int(b):
b_l = len(b)
x = 0;
i = 0
while i < b_l:
x += int(b[i]) * 2 ** (b_l - i - 1)
i = i + 1
return x
# Goal: Find logical difference between "a AND (b OR NOT c)" and "a AND b OR NOT c"
import random
chars = ["T", "F"]
combinationgram = []
i = 0
while i < 2 ** 3:
combination = []
binary = '101111000011010101100000';
bin_len = len(binary)
x = 0;
i = 0
while i < bin_len:
x += int(binary[i]) * 2 ** (bin_len - i - 1)
i = i + 1
print(x)
x = 102385; # Can be any unsigned integer of your liking.
bin = ''
while x != 0:
z = x % 2;
x = (x / 2) - (z / 2)
bin += str(int(z))
print(bin[::-1])
<?php
foreach ($configuration->requestList as $request) {
$video = $request->video;
$endpoint = $request->endpoint;
$lowestLatency = $endpoint->dataCenterLatency;
$selectedCache = null;
/**
* @var int $id
<?php
private static function getVectorFromConnection(int $connection): ?Vector3
{
switch ($connection) {
case 2:
return new Vector3(0, 0, -1);
break;
case 3:
return new Vector3(0, 0, 1);
@TheBlackPlague
TheBlackPlague / PlayerInput.cs
Last active December 9, 2018 22:18
An example version of code for Movement of a Player in 3D within Unity using the Entity Component System [Keyword: ECS].
/**
MIT License
Copyright (c) 2018 Shaheryar Sohail
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is