This file contains hidden or 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
local cjson = require "cjson" | |
-- Basic account info | |
local client_id = "" | |
local client_secret = "" | |
local refresh_token = "" | |
local function getAuth() | |
local mes="client_id="..client_id | |
mes=mes.."&client_secret="..client_secret |
This file contains hidden or 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
program main | |
print *, fib(30) | |
contains | |
recursive function fib(n) result(res) | |
integer :: n | |
integer :: res | |
if (n <= 2) then |
This file contains hidden or 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 Data.Complex | |
maxIter :: Int | |
maxIter = 127 | |
magnification :: Double | |
magnification = 10.0 | |
xrange :: [Int] | |
xrange = [-30..30] |
This file contains hidden or 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 ExtendedDefaultRules, NoMonomorphismRestriction #-} | |
import Conduit | |
main :: IO () | |
main = do | |
let cnt = 100000000 | |
successes <- sourceRandomN cnt $$ lengthIfC (\(x, y) -> x*x + y*y < 1) | |
print $ successes / cnt * 4 | |
-- https://www.fpcomplete.com/blog/2014/03/monte-carlo-haskell |
This file contains hidden or 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 -*- | |
# backward monte carlo simulator of one dimensional radiative transfer | |
# detector location is the top of atmosphere | |
np = 10000 # number of photon | |
tau = 1.0 # optical thickness | |
alb = 0.5 # surface albedo | |
omg = 0.5 # single scattering albedo |
This file contains hidden or 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 -*- | |
# monte carlo simulation of one dimensional radiative transfer | |
# | |
# The original code written in Fortran 77 | |
# "Modeling of radiative transfer in cloudy atmospheres | |
# and plant canopies using Monte Carlo methods", Tech. rep FTR, 7 | |
This file contains hidden or 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 -*- | |
require 'grooveshark' | |
client = Grooveshark::Client.new | |
songs = client.search_songs('素晴らしい世界 FLOWER FLOWER') | |
songs.each do |s| | |
puts "#{s.name} - #{s.artist}" |
This file contains hidden or 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 -*- | |
=begin | |
if input is below... | |
>>> | |
AAAA | |
30.3 | |
BBBB | |
502.0 |
This file contains hidden or 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 -*- | |
require 'net/http' | |
require 'uri' | |
require 'json' | |
flightIds=ARGV | |
api_url='mobile.api.fr24.com/common/v1/flight-playback.json' |
This file contains hidden or 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/sh | |
CMDNAME=`basename $0` | |
if [ ! $# -eq 2 ]; then | |
echo "Usage: $CMDNAME output flightId" 1>&2 | |
exit 1 | |
fi | |
output=$1 |