Skip to content

Instantly share code, notes, and snippets.

View cosmo0920's full-sized avatar
🏠
Working from home

Hiroshi Hatake cosmo0920

🏠
Working from home
View GitHub Profile
@cosmo0920
cosmo0920 / opencl-1.0.3.2.ebuild
Created August 7, 2012 18:28
HaskellでOpenCLするためのebuild
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
# ebuild generated by hackport 0.2.18.9999
CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
inherit haskell-cabal
@cosmo0920
cosmo0920 / getCLDeviceInfo.hs
Created August 8, 2012 13:01
Control.Parallel.OpenCLでOpenCLの情報を取得
import Control.Parallel.OpenCL
import Distribution.System (buildOS, OS(..))
-- clDeviceCheck
clDeviceCheck :: IO ()
clDeviceCheck = do
platforms <- clGetPlatformIDs
clDevices platforms
clDevices platforms = do
@cosmo0920
cosmo0920 / ft_1d.cl
Last active October 8, 2015 16:58
試しに実装してみた@OpenCL
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
typedef double tfloat;
#elif defined(cl_amd_fp64)
#pragma OPENCL EXTENSION cl_amd_fp64 : enable
typedef double tfloat;
#else
typedef float tfloat;
#endif
__kernel void arrayft_1d(__global const tfloat in[], __global tfloat out[])
@cosmo0920
cosmo0920 / macro.cl
Created August 16, 2012 21:57
OpenCLの悲しいマクロ
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
typedef double tfloat;
#elif defined(cl_amd_fp64)
#pragma OPENCL EXTENSION cl_amd_fp64 : enable
typedef double tfloat;
#else
typedef float tfloat;
#endif
@cosmo0920
cosmo0920 / after_delete_miquire
Created September 8, 2012 12:35
mikutter0.2のろぐ
/media/Data/mikutter/core/mui/cairo_timeline.rb:48:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
from /media/Data/mikutter/core/mui/gtk_timeline_utils.rb:30:in `new'
from /media/Data/mikutter/core/mui/gtk_timeline_utils.rb:30:in `new'
from /media/Data/mikutter/plugin/call_api_fav.rb:25:in `block in <top (required)>'
from /media/Data/mikutter/plugin/call_api_fav.rb:21:in `initialize'
from /media/Data/mikutter/plugin/call_api_fav.rb:21:in `new'
from /media/Data/mikutter/plugin/call_api_fav.rb:21:in `<top (required)>'
from /opt/miku/rb193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /opt/miku/rb193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /media/Data/mikutter/core/plugin.rb:409:in `load_file'
@cosmo0920
cosmo0920 / profile.rb.patch
Created September 18, 2012 01:24
i_profileの表示の最後の"}"が気になる…
--- profile.rb.orig 2012-09-17 17:40:23.000000000 +0900
+++ profile.rb 2012-09-18 10:22:02.560279855 +0900
@@ -20,7 +20,7 @@
on_show_profile do |service, user|
container = profile_head(user)
- i_profile = tab nil, "#{user[:name]} のプロフィール}" do
+ i_profile = tab nil, "#{user[:name]} のプロフィール" do
set_icon user[:profile_image_url]
set_deletable true
@cosmo0920
cosmo0920 / conditions_add_notsystem_cond.patch
Created September 20, 2012 15:41
nested_quote.rbのcommandが0.2で動かないorz
--- core/plugin/command/conditions.rb 2012-09-21 00:37:56.497075247 +0900
+++ core/plugin/command/conditions.rb.edited 2012-09-21 00:38:14.050407983 +0900
@@ -71,6 +71,11 @@
# TL上のテキストが一文字でも選択されている
TimelineTextSelected = Condition.new{ |opt| opt.widget.selected_text(opt.messages.first) }
+ #TL上のメッセージがシステムメッセージではない
+ NotSystem = Condition.new{ |opt|
+ not opt.messages.empty? { |m|
+ not m.messages.system? } }
@cosmo0920
cosmo0920 / rgb2gray.cpp
Created September 26, 2012 17:14
OpenCV2.3での白黒変換
#include <opencv/cv.h>
#include <opencv/highgui.h>
using namespace cv;
int main(int argc, char** argv)
{
const char *imagename = argc > 1 ? argv[1] : "../image/hoge.png";
Mat src_img = imread(imagename);
if(!src_img.data)
return -1;
@cosmo0920
cosmo0920 / alpha_value.el
Created September 28, 2012 13:57
Emacsを半透明・透明にする
;; Emacsを半透明・透明にする
(global-set-key "\C-xa"
(lambda () (interactive)
(set-frame-parameter nil 'alpha 80)))
(global-set-key "\C-ca"
(lambda () (interactive)
(set-frame-parameter nil 'alpha 100)))
@cosmo0920
cosmo0920 / diff_show_twit_message.patch
Created October 1, 2012 21:54
show_faceを使って何処のツイートを指しているかを見てみる
--- nested_quote.rb.orig 2012-10-02 00:24:24.000000000 +0900
+++ nested_quote.rb 2012-10-02 06:51:49.000000000 +0900
@@ -179,6 +179,13 @@
Plugin.create :nested_quote do
command(:copy_tweet_url,
name: 'ツイートのURLをコピー',
+ show_face: Proc.new{ |m|
+ whotwi = m.messages.first.message.idname
+ if m.messages.first.message.to_s.length > 20 then
+ show_message = m.messages.first.message.to_s[0, 20] + "..."