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 bpy | |
def delete_all(): | |
bpy.ops.object.select_all(action='SELECT') | |
bpy.ops.object.delete(True) | |
def main(): | |
delete_all() | |
bpy.ops.mesh.primitive_cylinder_add(vertices=100, |
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 python3 | |
# このサイトに書かれてることをほぼそのままやってます。 | |
# http://jellyware.jp/kurage/raspi/shutdown_button.html | |
import time | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BCM) | |
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 python3 | |
import urllib.request | |
def main(): | |
req = urllib.request.Request('http://octoprint:5000/api/connection') | |
req.add_header('X-Api-Key', 'C14B4FA3BE854CAAA740A43BEAFD6FB3') | |
with urllib.request.urlopen(req) as f: | |
print(f.read().decode()) |
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 python3 | |
import urllib.request | |
import json | |
req = urllib.request.Request('http://octoprint:5000/api/util/test') | |
req.add_header('X-Api-Key', 'C14B4FA3BE854CAAA740A43BEAFD6FB3') | |
req.add_header('Content-Type', 'application/json') | |
json_data = json.dumps( |
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
$ diff -U 0 /home/pi/.octoprint/config.yaml{.org,} | |
--- /home/pi/.octoprint/config.yaml.org 2019-05-22 20:37:26.200920294 +0900 | |
+++ /home/pi/.octoprint/config.yaml 2019-05-22 23:30:40.898185910 +0900 | |
... snip ... | |
@@ -52,0 +53,6 @@ | |
+events: | |
+ enabled: true | |
+ subscriptions: | |
+ - command: /home/pi/Desktop/2019-0324-timelapse/light-led.py | |
+ event: ZChange |
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
from datetime import datetime | |
from urllib import request | |
now = datetime.now() | |
jpg_filename = now.strftime('%Y-%m%d-%H%M%S.jpg') | |
url = 'http://localhost:8080/?action=snapshot' | |
request.urlretrieve(url, jpg_filename) |
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
$ diff -U -1 /etc/wpa_supplicant/wpa_supplicant.conf{.org,} | |
--- /etc/wpa_supplicant/wpa_supplicant.conf.org 2018-07-01 12:39:15.459717941 +0900 | |
+++ /etc/wpa_supplicant/wpa_supplicant.conf 2019-08-17 19:03:48.257437750 +0900 | |
@@ -1,8 +1,9 @@ | |
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev | |
update_config=1 | |
country=JP | |
network={ | |
ssid="XXXXXXXXX" |
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 python3 | |
""" | |
Qiita に投稿されていたコードを参考にしています | |
https://qiita.com/pukin/items/3b791b8b759dd704f765 | |
""" | |
import fcntl | |
import termios | |
import sys |