Skip to content

Instantly share code, notes, and snippets.

@sean2121
sean2121 / gist:6d264c417b1a8628841fef9f58ed3d41
Last active June 14, 2019 02:26 — forked from pastak/gist:2b2ecfa3edf369f3f3bd
Gyazo-for-Linux install script for Linux Mint rafaela
#!/bin/bash
curl_check ()
{
echo "Checking for curl..."
if command -v curl > /dev/null; then
echo "Detected curl..."
else
echo "Installing curl..."
class Mailman
attr_reader :latitude_s, :longitude_s, :mjma, :depth
def initialize(latitude_s, longitude_s, mjma, depth)
@latitude_s = latitude_s
@longitude_s = longitude_s
@mjma = mjma
@depth = depth
@users = []
@sean2121
sean2121 / parser.rb
Created March 13, 2018 02:09
parser.rb
class Parser
class Error < StandardError; end
def initialize(row)
raise ArgumentError unless row.kind_of?(String)
CSV.parse(row) do |i|
@row_csv = i.map(&:freeze).freeze
end
raise Error, "Incorrect Format" if @row_csv.size > 16
end
version: 2.0
jobs:
checkout_code:
docker:
- image: circleci/ruby:2.4-node
- image: circleci/postgres:9.4.12-alpine
working_directory: ~/circleci-demo-workflows
steps:
- checkout
workflows:
version: 2
build-test-and-deploy:
jobs:
- build
- test1:
requires:
- build
- test2:
requires:
module EEW
module Calculator
include Math
#PGVから求めた震度を返す。
#IINSTR =2.68+1.72log(PGV) (4<IINSTR<7)
def shindo(latitude_s, longitude_s, mjma, depth, latitude_e, longitude_e)
d = two_points_distance(latitude_s, longitude_s, latitude_e, longitude_e, depth)
mw = mjma_to_mw(mjma)
fl = falut_length(mw)
@sean2121
sean2121 / to_mw.c
Last active February 19, 2018 14:56
float to_mw(float mjma)
{
float mw = mjma - 0.171 ;
return mw;
}
#include<stdio.h>
#include<math.h>
float distance(double, double, double, double);
int main(void)
{
//点P
double latitude_s = 35.658581;
double longitude_s = 139.745433;
@sean2121
sean2121 / gist:61c1c74b01c668ffe95818c97c13ecee
Last active April 15, 2018 03:27
IoTシステムをRubyで作ろう!GR-CITRUSでセンサープログラミング

必要なもの

  • Windows or Mac
  • GR-CITRUS、WA-MIKAN
  • マイクロUSBケーブル
  • ブレッドボード
  • ジャンパワイヤー(オスオス)
  • LED
  • CDSセル
  • 抵抗
  • 温湿度センサーモジュール

問題1. 選択肢の中からRubyの予約語ではないものを2つ選択してください。

  • A.super
  • B.begin
  • C.try
  • D.goto

問題2. 以下のコードを実行した出力として正しいものを1つ選択してください。

def foo (a, *b)
 p a