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 'rack' | |
require 'erb' | |
class RackApp | |
def call(env) | |
[200, {'Content-Type' => 'text/html'}, [<<END_HTML] | |
<html> | |
<head><title>Rack test</title></head> |
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
Public Class Form1 | |
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click | |
Dim count = Me.Controls.Cast(Of Control)().Count(Function(c) (TypeOf c Is TextBox) AndAlso DirectCast(c, TextBox).Text = "") | |
If (count > 0) Then | |
MessageBox.Show("エラー") | |
End If | |
End Sub |
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
Public Class Form1 | |
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click | |
Dim Requisite() As String = {"Txt_name", "Txt_jyusyo", "Txt_tel"} | |
' | |
'カレントコントロールから | |
'OfTypeでまずはパネルコントロールをフィルタ | |
'これをfromとし、 | |
'さらにテキストボックスをフィルタ Function(c) | |
'これに対し、Function(c1)で、配列Requisiteに入っている要素から、TextがNullのものを選択 Function(cc) |
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
<?php | |
class DefaultPassword { | |
public function generate(){ | |
//乱数初期化 | |
srand(); | |
//12文字以上16文字未満 | |
$in_length = rand(12,16); | |
//アルファベット | |
for($i=0;$i<25;++$i){ |
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 -*- | |
# | |
# http://buta9999.hatenablog.jp/entry/2014/01/30/010351を参考に作成 | |
require 'aws-sdk' | |
require 'yaml' | |
require 'pp' | |
require "optparse" | |
opts = OptionParser.new |
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
# | |
# このあたりも参照。 | |
# https://gist.github.com/taka328w/1615935 | |
# | |
#展開するインスタンスのベースになるAMI | |
base_image_id = "" | |
#インスタンスタイプ | |
instance_type = "" | |
#VPCに所属するサブネットID |
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
vpc_id = "" | |
subnet_id="" | |
private_ip = "" | |
#すでにローカルIPが使用されていないか? | |
ary_ips = [] | |
ec2.client.describe_network_interfaces(filters: [{ name: "vpc-id",values: [vpc_id]},{name: "subnet-id",values: [subnet_id]}])[:network_interface_set].each {|d| | |
d[:private_ip_addresses_set].each {|dd| | |
ary_ips.push(dd[:private_ip_address]) | |
} |
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
<?php | |
include_once "Cache/Lite.php"; | |
//キャッシュの生存時間は8時間 | |
$option = array( | |
"cacheDir" => "./cache/", | |
"lifeTime" => "28800" | |
); | |
$cache = new Cache_Lite($option); | |
function hoge($in_year,$in_month,$cache) { |
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
#PHP Unitテスト用(php5.6)Dockerファイルサンプル | |
FROM centos:centos6 | |
MAINTAINER Akira345 | |
# Set TimeZone | |
RUN echo 'ZONE="Asia/Tokyo"' > /etc/sysconfig/clock | |
# Yum Repo Setting | |
RUN sed -i -e 's/^#baseurl/baseurl/' /etc/yum.repos.d/CentOS-Base.repo |
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 -*- | |
require 'net/http' | |
require 'aws-sdk' | |
instance_id = Net::HTTP.get('169.254.169.254', '/latest/meta-data/instance-id') | |
ec2_region = 'ec2.' + Net::HTTP.get('169.254.169.254', '/latest/meta-data/placement/availability-zone').chop + '.amazonaws.com' | |
image_name = instance_id + '-' + Time.now.strftime("%Y%m%d%H%M") | |
comment = "automatically generated image" | |
@ec2 = AWS::EC2.new( |
OlderNewer