Skip to content

Instantly share code, notes, and snippets.

View r9y9's full-sized avatar
:shipit:
( ˘ω˘ ) zzz

Ryuichi Yamamoto r9y9

:shipit:
( ˘ω˘ ) zzz
View GitHub Profile
#!/bin/bash
# ulbw 監視スクリプト
set -e
app_path="/Users/Shared/wlbw/wlbw_ir.app"
tlb_cmd_stop=$(cat << EOS
ps ax | grep $app_path | grep -v grep | awk {'print \"kill\", \$1'} | sh
EOS)
@r9y9
r9y9 / test.sh
Created October 25, 2016 08:38
sedでゴリ押し
#!/bin/bash
REPL_RESULT=$(kotlinc << EOF
import java.time.*
println(OffsetDateTime.now().toString())
EOF)
TIME_STR=$(echo $REPL_RESULT | sed -e 's/\(.*\)println(OffsetDateTime.now().toString())\(.*\) >>>/\2/g' | awk '{print $1}')
echo $TIME_STR
@r9y9
r9y9 / kmeans.kt
Created October 8, 2016 16:25
kotlin入門二日目
/**
* Created by ryuyamamoto on 2016/10/07.
*/
import java.util.Random
fun computeDistance(x1: DoubleArray, x2: DoubleArray): Double {
var distance: Double = 0.0
for (d in x1.indices) {
distance += (x1[d] - x2[d]) * (x1[d] - x2[d])
from pylibfreenect2 import Freenect2, SyncMultiFrameListener
from pylibfreenect2 import FrameType, Registration, Frame
import sys
import numpy as np
import cv2
try:
from pylibfreenect2 import OpenGLPacketPipeline
pipeline = OpenGLPacketPipeline()
except:
@r9y9
r9y9 / render_to_mat.cpp
Last active May 15, 2017 11:16
[PCLVisualizer] Render to png, and then convert it to cv::Mat
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <vtkActor.h>
#include <vtkPNGWriter.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
@r9y9
r9y9 / multiframe_listener.py
Last active January 30, 2016 16:48
Similar one of Protonect in libfreenect2
# coding: utf-8
import numpy as np
import cv2
from pylibfreenect2 import Freenect2, FrameMap, SyncMultiFrameListener
from pylibfreenect2 import FrameType, Registration, Frame
from pylibfreenect2 import OpenGLPacketPipeline, CpuPacketPipeline
fn = Freenect2()
@r9y9
r9y9 / test.jl
Created January 24, 2016 10:26
Julia and C++
julia> using ProgressMeter
julia> cxx"""
#include <iostream>
#include <cmath>
double FooBar(size_t N) {
double result = 0.0;
$:(global progress_meter = Progress(icxx"return N;", 1); nothing);
for (size_t i = 0; i < N; ++i) {
@r9y9
r9y9 / openni2.cpp
Created January 20, 2016 09:03
openni2_grabber example
#include <iostream>
#include <mutex>
#include <pcl/io/openni2_grabber.h>
#include <pcl/visualization/pcl_visualizer.h>
typedef pcl::PointXYZ T;
class SimpleOpenNIViewer {
public:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@r9y9
r9y9 / blas2.jl
Last active December 19, 2015 20:52
BLAS.axpy! と forループ愚直計算はどっちが速いのか実験
function perf(a=1.0, N=1000; n=100)
srand(98765)
X = rand(N, N)
Y = rand(N, N)
println("N=$N")
print(" BLAS: ")
gc_enable(false)
gc()
@time for i in 1:n