Moved to here
This file contains hidden or 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
| """ | |
| The most atomic way to train and run inference for a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
This file contains hidden or 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 ctypes | |
| from ctypes import wintypes | |
| # Constants | |
| CDS_UPDATEREGISTRY = 0x01 | |
| DISP_CHANGE_SUCCESSFUL = 0 | |
| ENUM_CURRENT_SETTINGS = -1 | |
| class POINTL(ctypes.Structure): | |
| _fields_ = [("x", wintypes.LONG), ("y", wintypes.LONG)] |
This tutorial explains how Unison handles 'effectful' computations, like storing state or performing I/O, using abilities. It assumes you haven't come across abilities before, and covers everything from the ground up.
This is an unofficial tutorial, written before the one on unisonweb.org/docs. The approach taken here is slow and methodical. Your first stop should be the official tutorial, if you haven't seen it already.
This doc is a Unison transcript - the source is here.
Terminology note: other languages with ability systems typically call them 'effect handlers' or 'algebraic effects', but many of the ideas are the same.
This file contains hidden or 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
| #include <type_traits> | |
| #include <cocos2d.h> | |
| #pragma once | |
| //------------------------------------------------------------------------------ | |
| /// Transition adapter that pops current scene with transition passed as an argument. | |
| /// | |
| /// Example: |
This file contains hidden or 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
| // Blend Add Shader (as used in Diablo 3) | |
| // Uses the alpha channel to determine if the pixel needs to be blended additively or by transparency. | |
| // Is a good way prevent the additive buildup that makes a scene with a lot of particle effects white and unreadable while still having some particle texture features. | |
| // Idea by Julian Love - http://www.gdcvault.com/play/1017660/Technical-Artist-Bootcamp-The-VFX | |
| Shader "Custom/Blend Add Particle Test" | |
| { | |
| Properties | |
| { | |
| _MainTex("Base (RGB) Trans (A)", 2D) = "white" {} | |
| _BlendThreshold("Blend Treshold (0.0:Additive, 1.0:Trasparency)", Range(0.0, 1.0)) = 0.5 |
This file contains hidden or 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
| #ifdef GL_ES | |
| #define LOWP lowp | |
| precision mediump float; | |
| #else | |
| #define LOWP | |
| #endif | |
| const float offset = 1.0 / 128.0; | |
| varying vec2 v_texCoords; | |
| uniform sampler2D u_texture; |