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
#!/usr/bin/env python | |
""" | |
pyboard interface | |
This module provides the Pyboard class, used to communicate with and | |
control the pyboard over a serial USB connection. | |
Example usage: |
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
let sectorArcPath = function(x,y,r,startAngle,endAngle){ | |
endAngle = startAngle + ((endAngle-startAngle)%360); | |
let startX, startY, endX, endY; | |
startX = x+r*Math.sin(startAngle*Math.PI/180); | |
startY = y-r*Math.cos(startAngle*Math.PI/180); | |
endX = x+r*Math.sin(endAngle*Math.PI/180); | |
endY = y-r*Math.cos(endAngle*Math.PI/180); | |
let b= startY < endY ? 1 : 0; | |
let obtuse = Math.abs(startAngle-endAngle)>180?1:0; | |
let startSmaller = startAngle<endAngle ? 1 : 0; |
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 UnityEngine; | |
using UnityEditor; | |
public class SaveRenderTextureToFile { | |
[MenuItem("Assets/Save RenderTexture to file")] | |
public static void SaveRTToFile() | |
{ | |
RenderTexture rt = Selection.activeObject as RenderTexture; | |
Texture2D tex = new Texture2D(rt.width, rt.height, TextureFormat.RGB24, false); |
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
//faster | |
const mod = (n,d)=>n-d*Math.floor(n/d) |
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
int zigzag(int t, int scale){ | |
return abs(scale-((t+scale)%(2*scale))); | |
} |
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
[ | |
{ | |
"id": "68139e86.85018", | |
"type": "tcp in", | |
"z": "d29d489d.a5eb08", | |
"name": "tcp in", | |
"server": "server", | |
"host": "", | |
"port": "9000", | |
"datamode": "stream", |
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
let sphereRadius = 500/2; | |
let baseRadius = 240/2; | |
let height = 26.4; | |
function main () { | |
return cylinder({r1:baseRadius,r2:baseRadius-8,start:[0,0,0],end:[0,0,height],fn:120}).subtract( | |
sphere({r:sphereRadius,fn:120}).translate([0,0,sphereRadius+0.6]) | |
); | |
} |
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 <Arduino.h> | |
bool lineMatches(char *buffer,const char *comp, int len){ | |
return len>0 && strcmp(buffer,comp)==0; | |
} | |
bool lineStarts(char *buffer,const char *comp, int len){ | |
if(len==0){ | |
return false; | |
} |
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
import sys | |
import serial | |
import time | |
ser = serial.Serial("COM1", 9600) | |
#Open Relay | |
ser.write( b'\xA0\x01\x01\xA2' ) | |
time.sleep(1) |
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
brew install ffmpeg | |
find . -name "*.mp4" -exec ffmpeg -i {} -ar 44000 -acodec pcm_s16le {}.wav \; | |