This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"=================================================== | |
" gvimrc(vim8-Win64 GUIで動確) | |
"=================================================== | |
colorscheme desert " カラースキーム | |
set lines=50 " ウィンドウの縦幅 | |
set columns=120 " ウィンドウの横幅 | |
set guifont=MS_Gothic:h9 "半角文字の設定 | |
set guifontwide=MS_Gothic:h9 "全角文字の設定 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"=================================================== | |
" vimrc(vim8-Win64 GUIで動確) | |
"=================================================== | |
scriptencoding utf-8 "このファイルのエンコード | |
"--------------------------------------------------- | |
" ファイル系 | |
set fileencodings=utf-8,cp932 " ファイルを開いたときに自動認識するエンコード | |
set fenc=utf-8 "文字コードをUFT-8に設定 | |
set nobackup " バックアップファイルを作らない |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
two = [nil, nil].size | |
sp = two << (two + two) | |
class Hello; end | |
class World; end | |
print Hello.new.class.to_s + sp.chr + World.new.class.to_s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
one = [nil].size | |
two = one + one | |
three = two + one | |
four = three + one | |
five = four + one | |
six = five + one | |
seven = six + one | |
eight = seven + one | |
nine = eight + one | |
ten = nine + one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
#数値を16進数文字列に | |
p 65.to_s(16) #=> "41" | |
#数値をASCII文字に | |
p 65.chr #=> "A" | |
#文字列を16進数とみなして数値に | |
p "41".hex #=> 65 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pwmlib' | |
pwm = Pwmlib | |
pwm.set_range(1000) | |
0.step(1000, 100) do |i| | |
sleep(1) | |
puts "d=#{i}" | |
pwm.set_duty(i) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BCM2835 pwm lib | |
// | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <dirent.h> | |
#include <fcntl.h> | |
#include <assert.h> | |
#include <sys/mman.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// How to access GPIO registers from C-code on the Raspberry-Pi | |
// Example program | |
// 15-January-2012 | |
// Dom and Gert | |
// | |
// Access from ARM Running Linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
system('echo "4" > /sys/class/gpio/export') | |
system('echo "out" > /sys/class/gpio/gpio4/direction') | |
[0, 1].cycle do |sw| | |
system("echo #{sw} > /sys/class/gpio/gpio4/value") | |
sleep(0.5) | |
end |