Skip to content

Instantly share code, notes, and snippets.

View loop-gcode.py
# -*- coding: utf-8 -*-
import math
import cmath
outfile=open("out.gcode","w")
feedrate=0.03 #depends on youre printer
temperature=250
speed=3000
@akirayou
akirayou / acckerman-link.mac
Created Nov 20, 2017
ackerman link calculation for maxima
View acckerman-link.mac
@akirayou
akirayou / acchi.cs
Created Nov 20, 2017
あっちの窓の行列forUnity
View acchi.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WindowCamCont : MonoBehaviour {
public Vector3 eyePos = new Vector3(0, 0, 0);
public Camera targetCamera;
public float displayWidth = 0.29f;
public float displayHeight = 0.16f;
public float nearPlane = 0;
@akirayou
akirayou / heater.rb
Created Nov 20, 2017
PCBヒータをkicadで作るスクリプト
View heater.rb
#!/usr/local/bin/ruby
# -*- coding: utf-8 -*-
$width= 1.8 #配線太さ(mm)
$T=18.0 #銅箔厚み(um)
$cu=1.72E-08 #銅電気伝導度
#縦方向サイズ関連
$step= $width * 2 + 1.6 #行って帰ってくるまでに縦方向に動く段差(配線ピッチの2倍)
$start=100 #描画開始y座標
View upload_test.php
<?php
header('Content-type: text/plain; charset=utf-8');
$uploaddir = '/home/akira/public_html/up/';
$id= uniqid();
if(isset($_POST['name']) && (0==preg_match("/[^0-9a-zA-Z]/",$_POST['name']) )){
$id=$_POST['name'];
}
$uploadfile = $uploaddir .$id.".bin";
View test_original.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View makeSimulationData.py
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 13 14:07:38 2016
@author: a-noda
"""
import numpy as np
data=np.random.randn(3*10000,1000).astype(np.float32)
y=0
View opencv_with_pyenv_memo.txt
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
#Need libpython, you have to build python with enable-shared
ONFIGURE_OPTS="--enable-shared" pyenv install 3.6.4
pyenv local 3.6.4
@akirayou
akirayou / cbi.py
Last active Mar 23, 2018
Class Random choice iterator for chainer , Class is not Label. For example, It's for multi sample from one target object. this target's ID is class.
View cbi.py
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 27 02:01:52 2016
@author: a-noda
"""
import numpy as np
from chainer.dataset import iterator
class ClassRandomIterator(iterator.Iterator):
'''
@akirayou
akirayou / bi.py
Created Mar 23, 2018
Label Balanced Iteretor for chainer
View bi.py
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 27 02:01:52 2016
@author: a-noda
"""
import numpy as np
from chainer.dataset import iterator
class BlanceIterator(iterator.Iterator):
'''