This file contains 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
""" | |
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 |
This file contains 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
# 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!" |
This file contains 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
// 程序启动器[win32] | |
// 一个小玩意,作用就是读取与 exe 同名的 .config 文件,并逐条并行执行,不显示窗口 | |
// 以 # 打头的行忽略 | |
// 用于开机挂载一些自带 cmd 窗口的程序 | |
// 自用 vs2017 编译测试通过 | |
// ver 1.1 | |
// 一个新语法:@命令 可以等待此命令结束后再继续运行 | |
// 例如 @ping 127.1 -n 3 等待3秒 |
This file contains 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 <GLFW/glfw3.h> | |
#include <yoga/Yoga.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
GLFWwindow* window; | |
/* Initialize the library */ | |
if (!glfwInit()) |
This file contains 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
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/ |
This file contains 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
/* C99, public domain licensed */ | |
#include <limits.h> | |
#include <stdbool.h> | |
#include <math.h> | |
/* utilities */ | |
#define SWAP(type, a, b) do { \ | |
type sw_ap; \ |
This file contains 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 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 |
This file contains 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
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): |