Skip to content

Instantly share code, notes, and snippets.

@TheGreyGhost
TheGreyGhost / KeyBindingInterceptor.java
Last active May 20, 2024 02:16
KeyBindingInterceptor (for Minecraft Forge mods). The purpose of this class is to intercept key presses (especially left and right mouse button clicks) before they are passed to the vanilla code. This gives the mod code greater flexibility in responding to them. For example- a staff which, when held: (1) left click performs an immediate attack (…
package speedytools.client;
/**
* The purpose of this class is to intercept key presses (especially left and right mouse button clicks) and allow
* greater flexibility in responding to them.
* The class replaces KeyBindings in GameSettings. When interception is on:
* .isPressed() is overridden to return false so that the vanilla code never receives the clicks.
* .pressed is always false.
* The true .isPressed() and .pressed are available using .retrieveClick() and .isKeyDown()
* Usage:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Scrollbar Windows 95 Style</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
@VictorTaelin
VictorTaelin / bhtt.md
Created January 26, 2024 03:37
Brief History of Type Theory

Brief history of Type Theory - Human Timeline

All started around 1930, when mathematicians discovered the λ-calculus. It was Turing complete, so we wrote programs on it. Everything was great, until the first program crashed and the first paradox was found. The world was in flames, so humans looked for better.

Around 1940, the simple type was discovered. It solved everything: math was consistent again, programs stopped crashing. People were happy, until someone tried to make a linked list.

"Why do I need to duplicate my entire codebase?" - asked the angry developers.

At this point, half of humanity gave up on types. A duck religion was born. The other half looked for better.

@ogabrielp
ogabrielp / react-parcel.sh
Last active May 20, 2024 02:06
Setup minimal React with Parcel
# References:
# 1. https://blog.logrocket.com/build-component-library-react-typescript/
# 2. https://parceljs.org/recipes/react/
react-parcel () {
# Create folder
mkdir "$1" && cd "$_"
# Initialize package.json and git local repo
npm init -y
@danielroe
danielroe / settings.json
Last active May 20, 2024 02:06
VScode settings for a minimal UI
{
// Disable telemetry
"telemetry.telemetryLevel": "off",
// Zen mode
"zenMode.fullScreen": false,
"zenMode.hideTabs": true,
"zenMode.centerLayout": false,
// Theming
"workbench.iconTheme": "city-lights-icons-vsc",
"editor.fontFamily": "Dank Mono",
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Scrollbar Windows 95 Style</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
import requests
import sys
import json
def waybackurls(host, with_subs):
if with_subs:
url = 'http://web.archive.org/cdx/search/cdx?url=*.%s/*&output=json&fl=original&collapse=urlkey' % host
else:
url = 'http://web.archive.org/cdx/search/cdx?url=%s/*&output=json&fl=original&collapse=urlkey' % host
@dhh
dhh / linux-setup.sh
Last active May 20, 2024 02:06
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl btop \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 20, 2024 02:02
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@SalvatorePreviti
SalvatorePreviti / gist:0ec6a73cb14cd33f12350ae27468f2e7
Last active May 20, 2024 02:00
GetFrustumLineIntersection - find the intersection of an infinite line with a view frustum in Unity (improved, with tolerance, stable on corner cases)
/// <summary>
/// Computes the intersection points between a frustum and an infinite line.
/// Finds the visible part of a segment in respect of a camera frustum.
/// Returns false if the line is not visible at all.
/// </summary>
/// <example>
/// var planes = GeometryUtility.CalculateFrustumPlanes(camera);
/// if (GetFrustumLineIntersection(camera, planes, ray, out d1, out d2)) {
/// Gizmos.DrawLine(ray.GetPoint(d1), ray.GetPoint(d2));
/// }