Skip to content

Instantly share code, notes, and snippets.

View dyama's full-sized avatar

Daisuke YAMAGUCHI dyama

View GitHub Profile
@dyama
dyama / twitcast.sh
Last active February 7, 2021 07:16
Simple recorder for Twitcasting.tv
#!/bin/bash
# coding: utf-8
# twitcast.sh by dyama
if [ -n "$1" ]; then
id=$(echo "$1" | sed 's|^.*/||g')
fname="${id}_$(date +'%F_%H-%M-%S').ts"
ffmpeg -i "http://twitcasting.tv/$id/metastream.m3u8" \
-vcodec copy -acodec copy -f mpegts "$fname"
else
# Windows (notepad) like keybinding for nano editor
# Modified by dyama, Original code written by zonuexe,
# license under GPLv3 or NYSL(0.9982)
# lastupdate: h261124
#
# how to install
# a. rename and move this file to $HOME/.nanorc
# % mv nanorc.keybindings $HOME/.nanorc
# b. concatenate this file with tail of $HOME/.nanorc
# % cat nanorc.keybindings >> $HOME/.nanorc
@dyama
dyama / update.sh
Created September 12, 2014 19:47
My markdown to html
#!/bin/bash
for file in `find . -type f -name '*.md' | xargs -I{} basename {} | sed 's/\.md$//g'`
do
(
echo '<!--#include file="head.html" -->'
markdown $file.md
echo '<!--#include file="foot.html" -->'
) > $file.html
chmod 644 $file.html
@dyama
dyama / lifegame-1.hsp
Created March 24, 2016 07:13
lifegame-hsp
/*
HSPによるライフゲームサンプル
参考文献:
『C言語による最新アルゴリズム辞典』奥村晴彦著/技術評論社
『人工生命の世界』服部桂/オーム社
*/
#define ScreenX 160
#define ScreenY 120
q = np.array([
[1, 0, 0, -width/2],
[0, 1, 0, -height/2],
[0, 0, 0, focal_length],
[0, 0, -1/tx, 0]
])
_points, _colors = calc_point_cloud(image, disp, q)
points = list(_points)
colors = list(_colors)
#!/usr/bin/python
# coding: utf-8
import numpy as np
import cv2
from matplotlib import pyplot as plt
img_left = cv2.imread("l.jpg",0)
img_right = cv2.imread("r.jpg",0)
img_left = cv2.GaussianBlur(cv2.equalizeHist(img_left), (3,3), 0)
img_right = cv2.GaussianBlur(cv2.equalizeHist(img_right) ,(3,3), 0)
@dyama
dyama / md5name.sh
Created May 8, 2016 11:20
md5name
#!/bin/sh
# coding: utf-8
if [ $# -gt 0 ]; then
for file in “$@”
do
if [ -f “$file” -a -s “$file” ]; then
# Get file extention
ext=`basename “$file” | sed ‘s/^.*\.\(.*\)$/\1/gi’`;
if [ “$file” == $ext ] ; then
@dyama
dyama / markov.rb
Created August 2, 2016 06:26
Markov
#!/usr/bin/ruby
# coding: utf-8
ts = {}
as = []
(`chasen source.txt`).each_line do |line|
as.push line.split(/\t/)[0]
end
@dyama
dyama / sample.lisp
Created June 15, 2016 10:58
Indended lisp sample
; ookiihou wo kaesu max kansuu
(defun ooki (x y)
(if (> x y)
x
y))
; fibonacchi suu wo kaesu
(defun fib (n)
(if (< n 2)
n
@dyama
dyama / indended-lisp.lisp
Created June 15, 2016 10:57
Indended lisp
; ookiihou wo kaesu max kansuu
defun ooki (x y)
if (> x y)
x
y
; fibonacchi suu wo kaesu
defun fib (n)
if (< n 2)
n