Skip to content

Instantly share code, notes, and snippets.

View 5HT2's full-sized avatar
🤍

froggie 5HT2

🤍
  • 23:26 (UTC +01:00)
View GitHub Profile
@MicaelJarniac
MicaelJarniac / youtubedl.md
Last active October 31, 2020 01:50
youtube-dl Forks and Mirrors
@andremichelle
andremichelle / shadertoy.kt
Created June 26, 2020 04:26
One file shadertoy shaders to openrndr
import org.openrndr.application
import org.openrndr.draw.*
import org.openrndr.internal.Driver
import org.openrndr.math.Vector2
import org.openrndr.math.Vector3
import java.io.File
class ShaderToy(fsCode: String) {
companion object {
fun fromFile(pathname: String): ShaderToy {
@elliotchance
elliotchance / README.md
Last active December 31, 2021 05:17
Kata: Human readable duration format

Your task in order to complete this Kata is to write a function which formats a duration, given as a number of seconds, in a human-friendly way.

The function must accept a non-negative integer. If it is zero, it just returns "now". Otherwise, the duration is expressed as a combination of years, days, hours, minutes and seconds.

It is much easier to understand with an example:

  format_duration(62)    # returns "1 minute and 2 seconds"
  format_duration(3662)  # returns "1 hour, 1 minute and 2 seconds"
@zeroeightysix
zeroeightysix / BrigadierDsl.kt
Created September 9, 2020 13:48
A small kotlin DSL for brigadier
import com.mojang.brigadier.CommandDispatcher
import com.mojang.brigadier.arguments.*
import com.mojang.brigadier.builder.ArgumentBuilder
import com.mojang.brigadier.builder.LiteralArgumentBuilder
import com.mojang.brigadier.builder.RequiredArgumentBuilder
import com.mojang.brigadier.context.CommandContext
@DslMarker
@Target(AnnotationTarget.TYPE)
annotation class BrigadierDsl
@PrashamTrivedi
PrashamTrivedi / DownloadRequest.kt
Last active February 25, 2023 12:43
Download File with progress indicator, written in Kotlin with Co-routines
suspend fun downloadFile(url: String,
downloadFile: File,
downloadProgressFun: (bytesRead: Long, contentLength: Long, isDone: Boolean) -> Unit) {
async(CommonPool) {
val request = with(Request.Builder()) {
url(url)
}.build()
val client = with(OkHttpClient.Builder()) {
addNetworkInterceptor { chain ->
@LambdAurora
LambdAurora / optifine_alternatives_fabric.md
Last active February 19, 2024 09:42
Recommended OptiFine alternatives on Fabric

The list is moving out!

If you share this list, please use this link instead: https://lambdaurora.dev/optifine_alternatives

It may still be only a redirection link, but it will have a better web display of the list soon. And the list being on GitHub/GitHub pages improves load times.

The gist version of this list will stop being updated.

Why?

@nightlark
nightlark / gist:6482130
Created September 8, 2013 05:37
Java class to look up a color name from the rgb values.
import java.util.ArrayList;
public class ColorNameLookup {
public class ColorName {
public int r,g,b;
public String name;
public ColorName(String name, int r, int g, int b) {
this.r = r;
this.g = g;
@zbeekman
zbeekman / GH-CF-strict-SSL-w-CDN.md
Last active March 8, 2024 18:12
Setting up GH-pages with custom domain, strict (end-to-end) SSL with CloudFlare DNS & CDN

Custom domains, GH-pages, Cloudflare and strict SSL end-to-end encryption

Why I wrote this

Before Github supported SSL encryption for github pages sites, many people were using CloudFlare (CF) as their DNS provider and CDN proxy. CF allowed users to enable SSL encryption from the CDN end points/proxies to the end user. This was great and it allowed visitors to your website to connect with a secure connection between their browser and the cloudflare CDN box that was serving your content. However, with this setup one (significant) link in the chain remained unencrypted and

@roycewilliams
roycewilliams / same-quad-list.txt
Last active March 21, 2024 07:03
same-quad-list.txt: a list of same-quad IPs by owner, with DNS status
#-----------------------------------------------------------------------
# same-quad-list.txt: a list of same-quad IPs by owner w/DNS status
#
# The CIDR network is the largest contiguous/bit-boundary-aligned block
# that is allocated to that entity (actual allocated range may be larger)
# NOTE: some ranges not yet converted to CIDR.
# Updates welcome - leave comment and/or ping royce@techsolvency.com
#-----------------------------------------------------------------------
# For human efficiency, some records are repeated here as comments.
#
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array