Skip to content

Instantly share code, notes, and snippets.

@nezuppo
nezuppo / azure-ubuntu-bionic-disable-ipv6.txt
Last active September 8, 2018 07:37
Azure 上の Ubuntu 18.04 で IPv6 無効化
$ diff -U 0 /etc/default/grub{.org,}
--- /etc/default/grub.org 2018-09-07 16:22:56.258467498 +0000
+++ /etc/default/grub 2018-09-08 07:25:50.275936372 +0000
@@ -11 +11 @@
-GRUB_CMDLINE_LINUX=""
+GRUB_CMDLINE_LINUX="ipv6.disable=1"
$ sudo update-grub
$ sudo shutdown -r now
@nezuppo
nezuppo / timelapse-for-twitter.txt
Last active September 8, 2018 07:39
連続写真からタイムラプス動画を作成して、Twitter 用に変換
$ mencoder mf://satellite/*.png -mf fps=25 -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o satellite.avi
$ avconv -i satellite.avi -c:v libx264 satellite.mp4
@nezuppo
nezuppo / led-control-with-raspi.sh
Last active September 19, 2018 13:37
Raspberry Pi で LED の明るさコントロール
#!/usr/bin/env python3
''' root 権限が無いとシステムがフリーズします '''
import wiringpi
import time
PWM_PIN = 18
STEP = 32
SLEEP_TIME = 0.05
@nezuppo
nezuppo / dish-drainer-support3.scad
Last active September 24, 2018 11:38
我が家の水切り固定用パーツ。
$fa = 0.01;
distance_y = 3.5;
pole_radius = 7;
thickness = 3;
outline_radius = 20;
pole_center = [outline_radius, distance_y + pole_radius];
#!/usr/bin/env python3
import wiringpi
import time
LED = {
'pin': 13,
'min': 0,
'max': 1024,
}
@nezuppo
nezuppo / diff_extrude.scad
Created October 28, 2018 02:24
OpenSCAD で同じ高さに linear_extrude した 2D を重ね合わせた場合でもプレビューで綺麗に表示できるよう、diff_extrude() モジュールを作りました。
module diff_extrude(thickness, colors) {
if (0 < $children) {
for (i=[0:$children - 1]) {
this_color = i < len(colors) ?
colors[i] : "black";
color(this_color)
linear_extrude(thickness)
difference() {
children(i);
@nezuppo
nezuppo / test-nut-w14.scad
Last active February 23, 2019 11:36
カメラ三脚の W 1/4 ナット用の穴のサイズを確認するための OpenSCAD スクリプト
module circle_txt(dia, trans_y) {
translate([0, 14 * trans_y])
circle(d=dia, $fn=6);
}
module test_nut_w14() {
linear_extrude(3)
difference() {
translate([0, 13.5])
square([20, 47], true);
@nezuppo
nezuppo / zakuhead-servo-led.py
Created March 10, 2019 05:58
3/9 にツイートしたザクヘッド ラズパイケースの制御スクリプト
#!/usr/bin/env python3
import wiringpi
import time
LED = {
'pin': 13,
'min': 0,
'max': 128,
}
@nezuppo
nezuppo / gist:b593b9714abe2f7b2b5c095baf5c7f0b
Created March 10, 2019 12:19
Blender でオブジェクトに色を付けてみた
import bpy
DEPTH = 10
def delete_all():
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(True)
def main():
@nezuppo
nezuppo / blender-difference.py
Created March 12, 2019 14:55
blender で切り抜き
import bpy
# まずは全て削除
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(True)
# キューブを作成
bpy.ops.mesh.primitive_cube_add(location=(0, 0, 0))
cube_object = bpy.context.object
cube_object.dimensions = (5, 5, 1)