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 bash | |
if which mit-scheme &>/dev/null ; then | |
if [ $# -gt 0 ]; then | |
mit-scheme --quiet < $1 | |
else | |
echo "usage: $0 [scheme src]" | |
fi | |
else | |
echo "'mit-scheme' executable not found" | |
fi |
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
(define (inc i) (+ i 1)) | |
(define (product1 term a next b) | |
(if (> a b) | |
1 | |
(* (term a) | |
(product1 term (next a) next b)))) | |
(define (product2 term a next b) | |
(define (iter a result) |
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
% dpkg -l | egrep -i "psych|gstream|libgcc|libgl1|libglu1" | |
ii gir1.2-gst-plugins-base-1.0 1.2.4-1~ubuntu1 amd64 Description: GObject introspection data for the GStreamer Plugins Base library | |
ii gir1.2-gstreamer-1.0 1.2.4-0ubuntu1 amd64 Description: GObject introspection data for the GStreamer library | |
ii gstreamer0.10-alsa:amd64 0.10.36-1.1ubuntu2 amd64 GStreamer plugin for ALSA | |
ii gstreamer0.10-fluendo-mp3:amd64 0.10.23.debian-3 amd64 Fluendo mp3 decoder GStreamer 0.10 plugin | |
ii gstreamer0.10-nice:amd64 0.1.4-1 amd64 ICE library (GStreamer 0.10 plugin) | |
ii gstreamer0.10-plugins-bad:amd64 0.10.23-7.2ubuntu1 amd64 GStreamer plugins from the "bad" set | |
ii gstreamer0.10-plugins-base:amd64 0.10.36-1.1ubuntu2 |
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 | |
require 'rack' | |
require 'socket' | |
require 'optparse' | |
ENV['RACK_ENV'] = "production" | |
# Options : | |
# --root (mandatory) | |
# --port (optional) |
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
// extract pixel from a CGImage | |
/* use case: | |
let extractor = PixelExtractor(img: UIImage(named: "gauge_vertical")!.CGImage!) | |
let color = extractor.color_at(x: 10, y: 20) | |
*/ | |
class PixelExtractor { | |
// taken from http://stackoverflow.com/questions/24049313/ | |
// and adapted to swift 1.2 |
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 java.util.*; | |
import java.io.*; | |
import java.security.*; | |
public class ChangePassword | |
{ | |
private final static JKS j = new JKS(); | |
public static void main(String[] args) throws Exception | |
{ |
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 System.Environment (setEnv, lookupEnv) | |
doWriteLog :: Int -> Int -> String -> IO () | |
doWriteLog logLevel messageLevel message | |
| messageLevel >= logLevel = putStrLn message | |
doWriteLog _ _ _ = return () | |
setLogLevel :: Int -> IO () | |
setLogLevel newLogLevel = do | |
setEnv "__loglevel" $ show newLogLevel |
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
document.getElementById('testbutton').onclick = (function () { | |
// 這邊的t和a只會定義一次 | |
var t = Math.tan(Math.PI * 0.2); | |
var a; | |
// 下面的function每次實行時都會重復使用上面的t和a | |
// 其他code看不到上面的t和a | |
return function() { | |
var i = 0; |
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
#!/bin/bash | |
set -o pipefail | |
set -e | |
# the link to download list can be obtained with "send the list via mail" | |
# mine was https://www.dell.com/support/home/jp/ja/jpdhs1/Drivers/DownloadListDetails?downloadListId=81a3eea8-706d-4fc4-bb41-a17754e291c5 | |
curl "https://www.dell.com/support/home/jp/ja/jpdhs1/Drivers/DownloadListDetails?downloadListId=81a3eea8-706d-4fc4-bb41-a17754e291c5" \ | |
| egrep --only-match 'http.*?\.exe' -i \ | |
| xargs wget |
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
irb(main):011:0> pass1 = "あ" * 50 | |
=> "ああああああああああああああああああああああああああああああああああああああああああああああああああ" | |
irb(main):012:0> pass1.size | |
=> 50 | |
irb(main):013:0> pass1.bytes.size | |
=> 150 |