This is a WIP of a cheat-sheet that I will finish Eventually™
Mapping of the shader types to Heaps types:
Float = Float
Int = Int
Bool = Bool
""" | |
MIT License | |
Copyright (c) 2021 fy | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
# Pull the SDD1306 lib from here https://github.com/adafruit/micropython-adafruit-ssd1306/blob/master/ssd1306.py | |
from time import sleep_ms | |
from machine import Pin, I2C | |
from ssd1306 import SSD1306_I2C | |
buf = "wubba lubba dub dub " | |
i2c = I2C(-1, Pin(4),Pin(5),freq=40000) # Bitbanged I2C bus | |
assert 60 in i2c.scan(), "No OLED display detected!" |
// 程序启动器[win32] | |
// 一个小玩意,作用就是读取与 exe 同名的 .config 文件,并逐条并行执行,不显示窗口 | |
// 以 # 打头的行忽略 | |
// 用于开机挂载一些自带 cmd 窗口的程序 | |
// 自用 vs2017 编译测试通过 | |
// ver 1.1 | |
// 一个新语法:@命令 可以等待此命令结束后再继续运行 | |
// 例如 @ping 127.1 -n 3 等待3秒 |
#include <GLFW/glfw3.h> | |
#include <yoga/Yoga.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
GLFWwindow* window; | |
/* Initialize the library */ | |
if (!glfwInit()) |
using UnityEditor; | |
using UnityEngine; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Text.RegularExpressions; | |
// Object rendering code based on Dave Carlile's "Create a GameObject Image Using Render Textures" post | |
// Link: http://crappycoding.com/2014/12/create-gameobject-image-using-render-textures/ |
/* C99, public domain licensed */ | |
#include <limits.h> | |
#include <stdbool.h> | |
#include <math.h> | |
/* utilities */ | |
#define SWAP(type, a, b) do { \ | |
type sw_ap; \ |
/*! | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2016 by Blake Bowen (http://codepen.io/osublake/pen/OyPGEo) | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
def ROUND(a): | |
return int(a + 0.5) | |
def drawDDA(x1,y1,x2,y2): | |
x,y = x1,y1 | |
length = abs((x2-x1) if abs(x2-x1) > abs(y2-y1) else (y2-y1)) | |
dx = (x2-x1)/float(length) | |
dy = (y2-y1)/float(length) | |
print 'x = %s, y = %s' % (((ROUND(x),ROUND(y)))) | |
for i in range(length): |