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
# -*- coding: utf-8 -*- | |
try: | |
import RPi.GPIO as GPIO | |
import smbus | |
from Adafruit_LED_Backpack import SevenSegment | |
bus = smbus.SMBus(1) | |
seven_segment = SevenSegment.SevenSegment(address=0x70) | |
seven_segment.begin() |
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
<!DOCTYPE html> | |
<!-- | |
このファイルと同一のディレクトリに | |
ガントチャート表示したいスケジュールを書いたschedule.csvを置いてブラウザで開く。 | |
表示開始日時、表示終了日時を変更したい場合は下記のstart_time, end_timeを書き換える。 | |
TODO: 月末・月初に使うことを想定していないので修正する | |
== schedule.csvの例(完了/未完了をoxで書く,開始(日+時刻),完了(日+時刻),スケジュール名 == | |
complete,start,end,title | |
x,28 17:06,,チケット#1234の消化 |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<style> | |
path { | |
stroke: steelblue; | |
stroke-width: 2; | |
fill: none; | |
} |
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 "rubygems" | |
require "nokogiri" | |
require "open-uri" | |
ISSUES_URL = "https://github.com/:user/:repo/issues?state=:state" | |
def get_issues(user, repo, state='open') | |
url = ISSUES_URL.gsub(/:user\b/, user).gsub(/:repo\b/, repo).gsub(/:state\b/, state) | |
nokogiri = Nokogiri::HTML.parse(open(url)) | |
nokogiri.css('.issues table tr td a.js-navigation-open').map(&:text) |
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
{-# LANGUAGE OverloadedStrings #-} | |
-- need to "cabal install aeson" | |
import Data.Aeson | |
import qualified Data.Attoparsec as AP | |
import qualified Data.ByteString.Lazy.Char8 as LC | |
main = putStrLn $ LC.unpack $ encode $ forceEither $ AP.parseOnly json "{\"foo\":5}" |
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 | |
# | |
# .git/hooks/pre-commit以下に配置すると、カレントディレクトリ以下にTODOが | |
# 有る場合にコミットを禁止する。 | |
# FORCE_COMMITフラグが立っていればTODO有りでもコミットできる | |
exit 0 if ENV["FORCE_COMMIT"] == "true" | |
todo_files = Dir["#{Dir.pwd}/**/*"].select do |path| | |
File.read(path).all?{|line| (line =~ /TODO/) and (line !~ /#.*TODO/)} |
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
<script type="application/processing" target="processing-canvas"> | |
void setup(){ | |
screen_width = 1000; | |
screen_height = 1200; | |
bar_height = 20; | |
text_width = 700; | |
margin = 10; | |
bar_max_width = screen_width - margin*4 - text_width - 200; | |
size(screen_width,screen_height); |
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 "uri" | |
require "open-uri" | |
require "rexml/document" | |
BASE_URI = "http://example.com/" | |
# urlの結果からxpathにマッチする要素全体を配列で得る | |
def get_xml_match(url,xpath) | |
open(url) do |f| | |
return REXML::XPath.match(REXML::Document.new(f.read),xpath).to_a |
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
// chromeのcontent_scriptとして使う | |
// メインとなるテーブル | |
var table = $("<table/>"); | |
table.attr("border","2"); | |
$("div.top > div.doc").each(function(i,doc){ | |
// 挿入するテーブルのセル内データ | |
var description = $(doc).find("p").html(); // 各関数の解説部分 | |
var src = $(doc).find("pre").html(); // 各関数のサンプルソース | |
// 挿入するセル |
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
import Text.ParserCombinators.Parsec | |
inFix :: Parser a -> Parser a | |
inFix p = try (p) <|> try(anyChar >> inFix p) | |
q :: Parser String | |
q = do | |
string "foo(\"" | |
cs <- many1 (letter <|> char '_' <|> char '.') | |
string "\")" |
NewerOlder