Skip to content

Instantly share code, notes, and snippets.

View lin-ycv's full-sized avatar
:octocat:

Lin Yu-Chieh (Victor) lin-ycv

:octocat:
View GitHub Profile
@lin-ycv
lin-ycv / PictureFrame.cs
Created May 25, 2022 12:45
RhinoCS PictureFrame with Transparency
// Get png's
string[] files = System.IO.Directory.GetFiles(dir);
int i = 0;
if(place)
{
foreach(var pt in loc){
// Add PictureFrame
var id = doc.Objects.AddPictureFrame(// Guid
new Plane(pt, Vector3d.XAxis, Vector3d.ZAxis), // Plane
using System.Drawing;
// Descriptions
Component.Name = "Canvas Colour";
Component.Description = "Changes colour of canvas background and grid";
Component.Params.Input[0].Name = "Enable";
Component.Params.Input[0].NickName = "E";
Component.Params.Input[0].Description = "Toggle to enable/disable custom colour settings";
Component.Params.Input[1].Name = "Background Colour";
Component.Params.Input[1].NickName = "B";
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Input;
this.Component.Description = "Copy all wires connected to a node to another node.";
this.Component.Name = "Copy Wires";
this.Component.NickName = "Copy";
Instances.ActiveCanvas.KeyUp -= keyHandle;
Instances.ActiveCanvas.KeyUp += keyHandle;
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522
import time
import datetime
relayPin = 4
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(relayPin, GPIO.OUT)
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522
import time
import datetime
import csv
relayPin = 4
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
@lin-ycv
lin-ycv / BambuAPI-AppsScript.js
Last active November 15, 2024 07:09
Apps Script to communicate with Bambu Cloud API and get printer status
// based on https://github.com/t0nyz0/BambuBoard/blob/main/bambuConnection.js
// and https://github.com/Doridian/OpenBambuAPI/blob/main/cloud-http.md
// https://bambulab.com/api/sign-in/form give 403 forbidden
const sProp = PropertiesService.getScriptProperties();
const account = sProp.getProperty('account');
const password = sProp.getProperty('password');
const sheetid = sProp.getProperty('sheetid');
const api = (e) => 'https://api.bambulab.com/v1/' + e;
const login = 'user-service/user/login';
@lin-ycv
lin-ycv / Bambu-LocalMQTT-Command.py
Created November 14, 2024 11:06
Simple python script that sends a pause command to a Bambu printer over local MQTT
import ssl
import paho.mqtt.client as mqtt
user = 'bblp'
printer={'ip': '<LAN-IP>', 'sn': '<SERIAL-NUMBER>', 'ac': '<ACCESS-CODE>'}
}
port = 8883
command = '{"print": {"sequence_id": "0", "command": "pause"}}'
def topic(sn):