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/env ruby | |
# -*- coding: utf-8 -*- | |
# 接続中のWiFiのSSIDからインターネットにチェックインするやつ | |
ssid = `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I`.split(/\n/).find{|line| line =~ /\bSSID/ }.scan(/SSID: (.+)$/).flatten.first | |
system "open 'http://t.heinter.net/#{ ssid }'" |
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/env ruby | |
puts `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I`.split(/\n/).find{|line| line =~ /\bSSID/ }.scan(/SSID: (.+)$/).flatten.first |
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
package main | |
import "fmt" | |
func Cbrt(x complex128) func() complex128 { | |
z := complex128(1) | |
return func() complex128 { | |
z=z-(z*z*z-x)/(3*z*z) | |
return z | |
} |
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
package main | |
import "fmt" | |
func mynumber() map[string]func(int) int { | |
sum := 0 | |
result := make(map[string]func(int)int) | |
result["add"] = func(x int) int { | |
sum += x | |
return sum |
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
package main | |
import "math" | |
import "code.google.com/p/go-tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
pic := make([][]uint8, dy) | |
for y := range pic { | |
line := make([]uint8, dx) | |
pic[y] = line |
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
package main | |
import ( | |
"fmt" | |
) | |
func Sqrt(x float64) float64 { | |
return _sqrt(x, 0, 10); | |
} |
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/env ruby | |
source = ARGV.first | |
dest = '' | |
def extract(word) | |
if `look #{word}`.split(/\n/).include? word | |
return word | |
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
;; This function is quoted from this page. Thanks to Tomohiro Matsuyama. | |
;; http://dev.ariel-networks.com/Members/matsuyama/pretty-lambda-in-emacs/ | |
(defun set-pretty-patterns (patterns) | |
(loop for (glyph . pairs) in patterns do | |
(loop for (regexp . major-modes) in pairs do | |
(loop for major-mode in major-modes do | |
(let ((major-mode (intern (concat (symbol-name major-mode) "-mode"))) | |
(n (if (string-match "\\\\([^?]" regexp) 1 0))) | |
(font-lock-add-keywords major-mode | |
`((,regexp (0 (prog1 () |
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
<div style="position: fixed; bottom: 0; right: 0; opacity: 0.8;z-index:10000"><iframe width="420" height="315" src="//www.youtube.com/embed/Qp9-V3QSafA?autoplay=1" frameborder="0" allowfullscreen></iframe><br><iframe width="420" height="315" src="//www.youtube.com/embed/dQw4w9WgXcQ?autoplay=1" frameborder="0" allowfullscreen></iframe></div> |
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/env ruby | |
# Copy random LGTM to clipboard | |
require 'open-uri' | |
require 'nokogiri' | |
require 'shellwords' | |
doc = Nokogiri open('http://www.lgtm.in/g') |