Skip to content

Instantly share code, notes, and snippets.

@gigaherz
gigaherz / 00 Explanation.md
Last active May 11, 2024 21:10
Custom shader rendertype mini-howto example (forge 37.0.15+)

Making a custom render type with a custom shader requires a number of things to exist at once:

  1. A ShaderInstance which references your shader json. The RegisterShadersEvent lets you define a ShaderInstance, and has a callback for when the shader is fully loaded from disk.
  2. A ShaderStateShard with a supplier that returns the ShaderInstance. The supplier exists so that shaders can reload themselves when you change resourcepacks or do a F3+T reload.
  3. A RenderType which uses the ShaderStateShard as its shader state.
  4. A shader json, which declares the shader properties and points to the shader programs (vsh and fsh).
  5. A vertex shader program, which describes how the vertex data is transformed before passing into the rasterizer and being turned into pixels.
  6. A fragment shader program, which describes how the interpolated values from the vertices get turned into color values before being passed into the output blending stage.

Note: The vanilla logic does not normally allow namespaces in the shader

package org.ygl.openrndr.demos
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.color.mix
import org.openrndr.draw.BlendMode
import org.openrndr.draw.DrawPrimitive
import org.openrndr.draw.LineCap
import org.openrndr.draw.VertexElementType
import org.openrndr.draw.renderTarget
@ereli
ereli / countries.sql
Last active May 11, 2024 21:08 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes. PostgreSQL compatible
CREATE SEQUENCE country_seq;
CREATE TABLE IF NOT EXISTS country (
id int NOT NULL DEFAULT NEXTVAL ('country_seq'),
iso char(2) NOT NULL,
name varchar(80) NOT NULL,
nicename varchar(80) NOT NULL,
iso3 char(3) DEFAULT NULL,
numcode smallint DEFAULT NULL,
phonecode int NOT NULL,
@hansrajdas
hansrajdas / vim.md
Last active May 11, 2024 21:06
VIM commands

Acronym

  • C-a ==> CTRL-a

Modes in VIM

  • Normal mode(n) When we open mode, the default mode is normal
  • Insert mode(i) When we want to insert some text, we press i, a or A etc to go in insert mode
  • Command mode(c) When we type colon(:) from normal mode, we enters command mode
  • Visual mode(v) Using v or V or C-i

Start VIM

@rikka0w0
rikka0w0 / debian-i386.sh
Created January 24, 2021 15:44
Install a Debian 10 i386 proot enviroment in Termux
#!/data/data/com.termux/files/usr/bin/bash
## --- README ---
## Download and run this script and wait....
## The key is to have qemu-i386-static in /data/data/com.termux/files/usr/bin/
## Reference: https://github.com/AllPlatform/Termux-UbuntuX86_64/blob/master/Ubuntu-i386.sh
pkg install proot -y
folder=debian-fs
if [ -d "$folder" ]; then
first=1
echo "skipping downloading"
@greymd
greymd / sudo新一.md
Last active May 11, 2024 21:01
sudo新一

 オレは高校生シェル芸人 sudo 新一。幼馴染で同級生の more 利蘭と遊園地に遊びに行って、黒ずくめの男の怪しげな rm -rf / 現場を目撃した。端末をみるのに夢中になっていた俺は、背後から近づいてきたもう1人の --no-preserve-root オプションに気づかなかった。 俺はその男に毒薬を飲まされ、目が覚めたら・・・ OS のプリインストールから除かれてしまっていた!

sudo がまだ $PATH に残っていると奴らにバレたら、また命を狙われ、他のコマンドにも危害が及ぶ』

 上田博士の助言で正体を隠すことにした俺は、 which に名前を聞かれて、とっさに『gnuplot』と名乗り、奴らの情報をつかむために、父親がシェル芸人をやっている蘭の $HOME に転がり込んだ。ところが、このおっちゃん・・・とんだヘボシェル芸人で、見かねた俺はおっちゃんになりかわり、持ち前の権限昇格能力で、次々と難タスクを解決してきた。おかげで、おっちゃんは今や世間に名を知られた名エンジニア、俺はといえばシェル芸 bot のおもちゃに逆戻り。クラスメートの convertojichattextimg にお絵かきコマンドと誤解され少年ワンライナーお絵かき団を結成させられる始末。

 ではここで、博士が作ってくれたメカを紹介しよう。最初は時計型麻酔 kill 。ふたについた照準器にあわせてエンターを押せば、麻酔シグナルが飛び出し、プロセスを瞬時に sleep させることができる。 次に、蝶ネクタイ型 banner 。裏についているダイヤルを調整すれば、ありとあらゆる大きさのメッセージを標準出力できる。必殺のアイテムなら fork 力増強シューズ。電気と磁力で足を刺激し、 :(){ :|:& };: でプロセステーブ

@willurd
willurd / web-servers.md
Last active May 11, 2024 21:00
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@IanKeen
IanKeen / Storage.swift
Last active May 11, 2024 21:00
PropertyWrapper: Storage to extend support for more types using `@AppStorage`
@propertyWrapper
struct Storage<T: AppStorageConvertible>: RawRepresentable {
var rawValue: String { wrappedValue.storedValue }
var wrappedValue: T
init?(rawValue: String) {
guard let value = T.init(rawValue) else { return nil }
self.wrappedValue = value
}
init(wrappedValue: T) {