202310¶
prusa slicerでreplicator 2x rev0.1¶
; start gcode
M73 P0 ; enable build progress
G162 X Y F3000 ; home XY maximum
G161 Z F1200 ; home Z minimum
;G92 Z-5 ; set Z to -5
G1 Z0 ; move Z to 0
G161 Z F100 ; home Z slowly
M132 X Y Z A B ; recall home offsets
M135 T0; ADD BY HASHIMOTO
G1 X-130 Y-75 Z30 F9000 ; move to wait position off table
G130 X20 Y20 Z20 A20 B20 ; lower stepper Vrefs while heating
; M126 Sfan_speed_pwm
;M140 S{bed_temperature[0]} T0 ;
;M104 S{temperature[0]} T0
;M104 S{temperature[1]} T1
M133 T0 ; stabilize extruder temperature
G130 X127 Y127 Z40 A127 B127 ; default stepper Vrefs
G92 A0 B0; zero extruder
;G1 X-100 Y-70 F9000
;G1 Z0.3 F6000
;G1 X-90 Y-70 E24 F2000
;G1 X-100 Y-70 F180
;G1 X-110 Y-70 F5000
;G1 Z0.5 F100
; start comment out1
G1 Z0.3 ; position nozzle
;G1 E25 F300 ; purge nozzle
G1 X-120 Y-70 Z0.15 F1200 ; slow wipe
G1 X-115 Y-65 Z0.5 F1200 ; lift
; end comment out1
G92 A0 B0; zero extruder
M73 P1 ;@body (notify GPX body has started)
; end of start gcode
; **** Replicator 2 end.gcode ****
M73 P100 ; end build progress
G1 Z155 F1000 ; send Z axis to bottom of machine
M140 S0 T0 ; cool down HBP
M104 S0 T0 ; cool down right extruder
M104 S0 T1 ; cool down left extruder
M127 ; stop blower fan
G162 X Y F3000 ; home XY maximum
M18 ; disable stepper
M72 P1 ; play Ta-Da song
; **** end of end.gcode ****
clang-format¶
find * | grep -E ".*(\.ino|\.cpp|\.c|\.h|\.hpp|\.hh)$" | xargs clang-format -i -style=LLVM
find . | grep -E ".*(\.ino|\.cpp|\.c|\.h|\.hpp|\.hh)$" | xargs clang-format -i -style=LLVM
EMAX 2806-100KV¶
- リアクションホイールにつかえそうなBLDC.
- ジンバル用あたりを探すといいっぽい.KV値は100くらいの低めのやつを狙う.
GitHub - joaojacome/bitwarden-ssh-agent: Small python script to load bitwarden-store ssh keys into ssh-agent¶
手が動かないときの対処法¶
- taskを簡単な順にならべて簡単なほうからやる
- 簡単じゃないと思ったら分割して小さくする
- くりかえし
GKE upgrade¶
export GKE_CHANNEL=REGULAR
export GKE_VER=1.25.10-gke.2700
export GKE_REGION=asia-northeast1
export GKE_CLUSTER=my-dev-master
export GKE_NODEPOOL=my-dev-pool
gcloud container get-server-config --flatten="channels" --filter="channels.channel=${GKE_CHANNEL}" --format="yaml(channels.channel,channels.validVersions)" --region=${GKE_REGION}
gcloud container clusters list
gcloud container node-pools list --cluster=${GKE_CLUSTER} --region=${GKE_REGION}
kubectl get nodes
gcloud container clusters upgrade ${GKE_CLUSTER} --master --cluster-version ${GKE_VER} --region=${GKE_REGION}
gcloud container clusters upgrade ${GKE_CLUSTER} --node-pool=${GKE_NODEPOOL} --cluster-version ${GKE_VER} --region=${GKE_REGION}
netbox v3.5.9 -> 3.6.xのマイグレーションでコケる¶
- 原因はindexがなかったから.
- netbox/netbox/extras/migrations/0094_tag_object_types.py at v3.6.0 · netbox-community/netbox · GitHub
RenameIndex
of fields('content_type', 'object_id')
をしたいのに,indexないのでErrorになっていた.- Indexを貼って再度migrationをしたら通った.migration後のindex nameをみるとちゃんとrename後の
extras_tagg_content_717743_idx
となっているので想定通りっぽそう.
netbox-docker-netbox-1 | ⚙️ Applying database migrations
netbox-docker-netbox-1 | 🧬 loaded config '/etc/netbox/config/configuration.py'
netbox-docker-netbox-1 | 🧬 loaded config '/etc/netbox/config/extra.py'
netbox-docker-netbox-1 | 🧬 loaded config '/etc/netbox/config/logging.py'
netbox-docker-netbox-1 | 🧬 loaded config '/etc/netbox/config/plugins.py'
netbox-docker-netbox-1 | Operations to perform:
netbox-docker-netbox-1 | Apply all migrations: account, admin, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, sessions, social_django, taggit, tenancy, users, virtualization, wireless
netbox-docker-netbox-1 | Running migrations:
netbox-docker-netbox-1 | Applying users.0004_netboxgroup_netboxuser... OK
netbox-docker-netbox-1 | Applying account.0001_initial... OK
netbox-docker-netbox-1 | Applying dcim.0173_remove_napalm_fields... OK
netbox-docker-netbox-1 | Applying dcim.0174_device_latitude_device_longitude... OK
netbox-docker-netbox-1 | Applying dcim.0174_rack_starting_unit... OK
netbox-docker-netbox-1 | Applying dcim.0175_device_oob_ip... OK
netbox-docker-netbox-1 | Applying dcim.0176_device_component_counters... OK
netbox-docker-netbox-1 | Applying dcim.0177_devicetype_component_counters... OK
netbox-docker-netbox-1 | Applying dcim.0178_virtual_chassis_member_counter... OK
netbox-docker-netbox-1 | Applying dcim.0179_interfacetemplate_rf_role... OK
netbox-docker-netbox-1 | Applying dcim.0180_powerfeed_tenant... OK
netbox-docker-netbox-1 | Applying dcim.0181_rename_device_role_device_role... OK
netbox-docker-netbox-1 | Applying extras.0093_configrevision_ordering... OK
netbox-docker-netbox-1 | Traceback (most recent call last):
netbox-docker-netbox-1 | File "/opt/netbox/netbox/./manage.py", line 10, in <module>
netbox-docker-netbox-1 | execute_from_command_line(sys.argv)
netbox-docker-netbox-1 | File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
netbox-docker-netbox-1 | utility.execute()
netbox-docker-netbox-1 | File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
netbox-docker-netbox-1 | self.fetch_command(subcommand).run_from_argv(self.argv)
netbox-docker-netbox-1 | File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
netbox-docker-netbox-1 | self.execute(*args, **cmd_options)
netbox-docker-netbox-1 | File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/base.py", line 458, in execute
netbox-docker-netbox-1 | output = self.handle(*args, **options)
netbox-docker-netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-docker-netbox-1 | File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/base.py", line 106, in wrapper
netbox-docker-netbox-1 | res = handle_func(*args, **kwargs)
netbox-docker-netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-docker-netbox-1 | File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/commands/migrate.py", line 356, in handle
netbox-docker-netbox-1 | post_migrate_state = executor.migrate(
netbox-docker-netbox-1 | ^^^^^^^^^^^^^^^^^
netbox-docker-netbox-1 | File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/migrations/executor.py", line 135, in migrate
netbox-docker-netbox-1 | state = self._migrate_all_forwards(
netbox-docker-netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-docker-netbox-1 | File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
netbox-docker-netbox-1 | state = self.apply_migration(
netbox-docker-netbox-1 | ^^^^^^^^^^^^^^^^^^^^^
netbox-docker-netbox-1 | File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
netbox-docker-netbox-1 | state = migration.apply(state, schema_editor)
netbox-docker-netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-docker-netbox-1 | File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/migrations/migration.py", line 132, in apply
netbox-docker-netbox-1 | operation.database_forwards(
netbox-docker-netbox-1 | File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/migrations/operations/models.py", line 1042, in database_forwards
netbox-docker-netbox-1 | raise ValueError(
netbox-docker-netbox-1 | ValueError: Found wrong number (0) of indexes for extras_taggeditem(content_type_id, object_id).
netbox=# \d extras_taggeditem
Table "public.extras_taggeditem"
Column | Type | Collation | Nullable | Default
-----------------+---------+-----------+----------+-----------------------------------------------
id | bigint | | not null | nextval('extras_taggeditem_id_seq'::regclass)
object_id | integer | | not null |
content_type_id | integer | | not null |
tag_id | bigint | | not null |
Indexes:
"extras_taggeditem_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints:
"extras_taggeditem_tag_id_d48af7c7_fk" FOREIGN KEY (tag_id) REFERENCES extras_tag(id) DEFERRABLE INITIALLY DEFERRED
netbox=# create index on extras_taggeditem (content_type_id, object_id);
CREATE INDEX
netbox=# \d extras_taggeditem
Table "public.extras_taggeditem"
Column | Type | Collation | Nullable | Default
-----------------+---------+-----------+----------+-----------------------------------------------
id | bigint | | not null | nextval('extras_taggeditem_id_seq'::regclass)
object_id | integer | | not null |
content_type_id | integer | | not null |
tag_id | bigint | | not null |
Indexes:
"extras_taggeditem_pkey" PRIMARY KEY, btree (id)
"extras_taggeditem_content_type_id_object_id_idx" btree (content_type_id, object_id)
Foreign-key constraints:
"extras_taggeditem_tag_id_d48af7c7_fk" FOREIGN KEY (tag_id) REFERENCES extras_tag(id) DEFERRABLE INITIALLY DEFERRED
netbox=#
netbox-docker-netbox-1 | ⚙️ Applying database migrations
netbox-docker-netbox-1 | 🧬 loaded config '/etc/netbox/config/configuration.py'
netbox-docker-netbox-1 | 🧬 loaded config '/etc/netbox/config/extra.py'
netbox-docker-netbox-1 | 🧬 loaded config '/etc/netbox/config/logging.py'
netbox-docker-netbox-1 | 🧬 loaded config '/etc/netbox/config/plugins.py'
netbox-docker-netbox-1 | Operations to perform:
netbox-docker-netbox-1 | Apply all migrations: account, admin, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, sessions, social_django, taggit, tenancy, users, virtualization, wireless
netbox-docker-netbox-1 | Running migrations:
netbox-docker-netbox-1 | Applying users.0004_netboxgroup_netboxuser... OK
netbox-docker-netbox-1 | Applying account.0001_initial... OK
netbox-docker-netbox-1 | Applying dcim.0173_remove_napalm_fields... OK
netbox-docker-netbox-1 | Applying dcim.0174_device_latitude_device_longitude... OK
netbox-docker-netbox-1 | Applying dcim.0174_rack_starting_unit... OK
netbox-docker-netbox-1 | Applying dcim.0175_device_oob_ip... OK
netbox-docker-netbox-1 | Applying dcim.0176_device_component_counters... OK
netbox-docker-netbox-1 | Applying dcim.0177_devicetype_component_counters... OK
netbox-docker-netbox-1 | Applying dcim.0178_virtual_chassis_member_counter... OK
netbox-docker-netbox-1 | Applying dcim.0179_interfacetemplate_rf_role... OK
netbox-docker-netbox-1 | Applying dcim.0180_powerfeed_tenant... OK
netbox-docker-netbox-1 | Applying dcim.0181_rename_device_role_device_role... OK
netbox-docker-netbox-1 | Applying extras.0093_configrevision_ordering... OK
netbox-docker-netbox-1 | Applying extras.0094_tag_object_types... OK
netbox-docker-netbox-1 | Applying extras.0095_bookmarks... OK
netbox-docker-netbox-1 | Applying extras.0096_customfieldchoiceset... OK
netbox-docker-netbox-1 | Applying extras.0097_customfield_remove_choices... OK
netbox-docker-netbox-1 | Applying extras.0098_webhook_custom_field_data_webhook_tags... OK
netbox-docker-netbox-1 | Applying ipam.0067_ipaddress_index_host... OK
netbox-docker-netbox-1 | Applying tenancy.0011_contactassignment_tags... OK
netbox-docker-netbox-1 | Applying virtualization.0035_virtualmachine_interface_count... OK
netbox-docker-netbox-1 | Applying virtualization.0036_virtualmachine_config_template... OK
netbox=# \d extras_taggeditem
Table "public.extras_taggeditem"
Column | Type | Collation | Nullable | Default
-----------------+---------+-----------+----------+-----------------------------------------------
id | bigint | | not null | nextval('extras_taggeditem_id_seq'::regclass)
object_id | integer | | not null |
content_type_id | integer | | not null |
tag_id | bigint | | not null |
Indexes:
"extras_taggeditem_pkey" PRIMARY KEY, btree (id)
"extras_tagg_content_717743_idx" btree (content_type_id, object_id)
Foreign-key constraints:
"extras_taggeditem_tag_id_d48af7c7_fk" FOREIGN KEY (tag_id) REFERENCES extras_tag(id) DEFERRABLE INITIALLY DEFERRED
netbox=#
ESP8266とESP32の5V tolerantについて¶
ESP3266はEspressif公式のdocumentに5V tolerantである旨の記述がされていた.
ESP32ではその記載は削除されていた.
このためmakerのなかではESP32のIOは5V tolerantではないのではないかという議論がされていた.
結論から言えばESP32もIO 5V tolerantのよう.
documentに5V tolerantである旨の記載をしたところ,電源として5Vを供給する人間が後を絶たなかったため,記載を削除したらしい.
ESP8266 | http://hackaday.com/2016/07/28/ask-hackaday-is-the-esp8266-5v-tolerant/
Teo Swee Ann: i can reply officially here: it is 5V tolerant at the IO. while the supply voltage is at 3.3V. Teo Swee Ann: ESP32 and ESP8285 are both 5V tolerant as well. Teo Swee Ann: Chris Gimson the reason is too many users took it to mean that the chip is 5 V tolerant. When we say 5 V tolerant, we are only referring to the IOs. So some users mistook this to make that they can power the chip entirely off the 5 V supply. The correct usage is to use 5 V open for these 5 V tolerant pins, and only via only drain configuration.
ESP32¶
General¶
- pin17-22(GPIO6-11)は内部でSPI Flashに接続されているため通常GPIOとしては利用しない.External Flashを使うならここを利用する.
- pin4-7(GPIO34-36, 39)はOPEN_DRAIN, 入力専用ポート
pin mode¶
- このへんが選べる
//GPIO FUNCTIONS
#define INPUT 0x01
// Changed OUTPUT from 0x02 to behave the same as Arduino pinMode(pin,OUTPUT)
// where you can read the state of pin even when it is set as OUTPUT
#define OUTPUT 0x03
#define PULLUP 0x04
#define INPUT_PULLUP 0x05
#define PULLDOWN 0x08
#define INPUT_PULLDOWN 0x09
#define OPEN_DRAIN 0x10
#define OUTPUT_OPEN_DRAIN 0x13
#define ANALOG 0xC0
//Interrupt Modes
#define DISABLED 0x00
#define RISING 0x01
#define FALLING 0x02
#define CHANGE 0x03
#define ONLOW 0x04
#define ONHIGH 0x05
#define ONLOW_WE 0x0C
#define ONHIGH_WE 0x0D
さまざまな思考実験/ジレンマ/パラドックス¶
growi upgrade¶
refs
mongo db upgrade
基本的に
db.adminCommand({getParameter: 1, featureCompatibilityVersion: 1})
を確認してdb.adminCommand({setFeatureCompatibilityVersion: "5.0"})
であげたいversionにする.再度上のコマンドで設定結果を確認.- dockerなら下記
# docker-compose exec mongo bash # mongosh # db.adminCommand({getParameter: 1, featureCompatibilityVersion: 1}) {"featureCompatibilityVersion": {"version": "3.6"}, "ok": 1} # db.adminCommand({setFeatureCompatibilityVersion: "4.4"})
3.6 -> 6.0とかはむりで,3.6 -> 4.4 -> 5.0 -> 6.0と踏む必要があるのでmongodbをあげるたびに上記を繰り返してstepを踏んであげていく.dockerだとver指定して再起動しつつ上の手順を踏めばok.
- upgrade pathについてはmongoのdocs参照
基本的にgrowi自体のverと付随してmongodb verを考慮してあげていけばok.今回はupgrade後にgrowi admin consoleでv5形式へのupgradeをして完了.
dockerでvolumeを移行する¶
- tl;dr
- docker volumeのあるdirをinspectでさがしてtarとかでかためてもっていく
$ docker volume ls
$ docker volume inspect {volume_name}
してpathがわかる.
そのpathにいって tar -cvf hoge huga
とかでかためてscpしてもっていく.
移行先ではあらかじめvolumeをたてて(空でいいので)おいて,いったんstopさせておいて(data整合性のため),inspect先のdirで既存のものをrmして持ってきてtarを展開してすりかえるのが楽そう.
- ref: ボリュームの利用 | Docker ドキュメント
- これはコンテナ内でマウントして同じことやってるだけで,inspectしてホスト側でやっても実質同じ.