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
fun StringBuilder.write( | |
vararg objects: Any?, | |
sep: String = "", | |
end: String = "", | |
prefix: String = "", | |
postfix: String = "" | |
) { | |
append(objects.joinToString(separator = sep, prefix = prefix, postfix = postfix)+end) | |
} |
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
// Begin code with LocalDate object date and LocalTime objects begin and end, and String objects title, content, location | |
Boolean allDay = begin.equals(LocalTime.of(0, 0)) && end.equals(LocalTime.of(23, 59)) | |
LocalDateTime startTime = date.atTime(begin) | |
LocalDateTime endTime = date.atTime(end) | |
Calendar startCal = Calendar.getInstance() |
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
infix fun <T, R> T.`=`(other: R) = this to other | |
class Object<T, R>(vararg vals: Pair<T, R>): HashMap<T, R>(hashMapOf(*vals)) { | |
/** | |
* duplicates the let keyword in JavaScript | |
* declare multiple keywords in the object | |
*/ | |
fun let(vararg pairs: Pair<T, R>) { | |
putAll(hashMapOf(*pairs)) | |
} |
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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace App | |
{ | |
class SuperArray<R> : IEnumerable<R> | |
{ | |
R[] BaseArray; |
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
// | |
// Created by ThePyProgrammer on 5/6/2021. | |
// | |
#include <cmath> | |
#include "Point.h" | |
#include <limits> | |
Point::Point(double x, double y) { |
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
# First let's check the status | |
git status | |
# We now add the file as in the arguments | |
for i in $(seq 2 $#); | |
do git add ${!i}; | |
done | |
# Commit files based on first argument | |
git commit -m "$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
import numpy as np | |
def convolve(image, kernel): | |
# We start off by defining some constants, which are required for this code | |
kernelH, kernelW = kernel.shape | |
imageH, imageW = kernel.shape | |
h, w = imageH + 1 - kernelH, imageW + 1 - kernelW | |
# filter1 creates an index system that calculates the sum of the x and y indices at each point | |
# Shape of filter1 is h x kernelW |
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 numpy as np | |
# Functions I painstakingly researched and coded with 2 shots of coffee at 3 am | |
def gamma(n): | |
""" | |
A Simplified Gamma Function for "powers" of 1/2 | |
Gamma Function for Integers are given by: Γ(n) = (n-1)! | |
Gamma Function for Values ending with 1/2: Γ(n) = 0.5 * 1.5 * ... * (n-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
import numpy as np | |
import matplotlib.pyplot as plt | |
import cv2 | |
from skimage.color import rgb2gray, gray2rgb | |
from skimage import filters | |
from skimage.transform import rescale, resize, downscale_local_mean, swirl | |
from skimage.filters import threshold_otsu, threshold_local, try_all_threshold | |
import skimage.io as skio | |
from PIL import Image, ImageOps |
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 requests | |
import pandas as pd | |
import re | |
from io import StringIO | |
def read_csv(loc, *args, **kwargs): | |
if re.search(r"[(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)", loc): | |
return read_csv(requests.get(loc, allow_redirects=True).content, *args, **kwargs) | |
loc = loc.strip("\n") | |
if re.search(r"[\n:<>\"/\|?*]", loc): |
OlderNewer