Skip to content

Instantly share code, notes, and snippets.

View sergeant-wizard's full-sized avatar
😵

Ryo Miyajima sergeant-wizard

😵
  • Preferred Networks
  • Tokyo
View GitHub Profile
JOINT_NAMES = [
'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint',
'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint'
]
class UR5Controller(object):
def __init__(self):
rospy.init_node('node', anonymous=True)
self.speed_pub = rospy.Publisher('ur_driver/joint_speed', JointTrajectory, queue_size=1)
import numpy as np
import cv2
img_size = 640
initial_nodes = np.array([
[+1.0, +1.0, +1.0, +1.0],
[+1.0, +1.0, +1.0, -1.0],
[+1.0, +1.0, -1.0, +1.0],
[+1.0, +1.0, -1.0, -1.0],
[+1.0, -1.0, +1.0, +1.0],
cd
git clone [email protected]:sergeant-wizard/rc_files
ln -s rc_files/.vimrc .vimrc
ln -s rc_files/tmux.conf.linux .tmux.conf
git clone https://github.com/robbyrussell/oh-my-zsh.git
git clone https://github.com/vim/vim.git
cd vim
./configure --with-features=huge --enable-multibyte --enable-pythoninterp=yes --enable-cscope --with-x --prefix=/home/ryo/vim/
@sergeant-wizard
sergeant-wizard / np_print.py
Created March 23, 2017 02:15
numpy print format
np.set_printoptions(formatter={'float': lambda x: '%+1.1f' % x}, linewidth=50)
@sergeant-wizard
sergeant-wizard / lin_eq_benchmark.py
Created March 2, 2017 08:46
linear equation performance
import scipy.linalg
import numpy as np
import sys
num_samples = 500000
n = 7
def inv(Q, x, num_eqs):
def show_mat(mat):
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.matshow(mat)
fig.colorbar(cax)
library(magrittr)
F <- function(y, theta) {
dnorm(y, mean = theta, sd = 1)
}
G0 <- function(theta) {
dnorm(theta, mean = 0, sd = 1)
}
library(plyr)
num_data <- 100
true_lambda <- 1
sample_from_distribution <- function(candidates, distribution, threshold) {
while (TRUE) {
x <- sample(candidates, size = 1)
dice <- runif(n = 1, min = 0, max = 1)
if (dice < distribution(x) / threshold) {
library(dplyr)
library(ggplot2)
extract_input <- function(data) {
return(data %>% select(c(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)))
}
extract_labels <- function(data) {
return(data %$% Species %>% factor)
}
@sergeant-wizard
sergeant-wizard / input.csv
Created November 25, 2015 10:34
NPB input.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 34 columns, instead of 1 in line 4.
0.02620087336,0,0,0,0,1,0,0,0,0,0,0,0,0.237037037,0.5070422535,0.6,0.6923076923,0,0.1212121212,0.5,0.6367980884,0.5735080058,0.6797752809,0.6111111111,0.7682926829,0.2727272727,0.479638009,0.7974683544,0.7183098592,0.4277777778,0.2958823529,0,0.2083333333,1
0.2358078603,0,0,1,0,0,0,0,0,0,0,0,0,0.6790123457,0.01408450704,0,0.07692307692,0,0,0,0.05256869773,0.03881610869,0.1011235955,0.05555555556,0.0487804878,0,0.01357466063,0.1392405063,0.1549295775,0.6777777778,0.3594117647,0.2173913043,0.5416666667,1
0.2139737991,0,0,0,1,0,0,0,0,0,0,0,0,0.1265432099,1,0.3333333333,0.1538461538,0,1,0.714,0.3261648746,0.3352741388,0.2921348315,0.1111111111,0.2682926829,0.09090909091,0.2805429864,0.2151898734,0.2253521127,0.2916666667,0.2111764706,0,0.375,1
0.05021834061,0,0,0,0,1,0,0,0,0,0,0,0,0.3067901235,0.3943661972,0.06666666667,0.2307692308,0,0.3333333333,0.25,0.146953405,0.1358563804,0.1853932584,0.2222222222,0.1341463415,0,0.09502262443,0.2025316456,0.2253521127,0.4222222222,0.3223529412,0.1739130435,0.4166666667,1
0.0