XAMPP 疑難雜症解決

XAMP = Apache + MariaDB + PHP + Perl

https://www.apachefriends.org/zh_tw/index.html

xampp set mysql password

https://achiuan.com/666/xampp-5-6-15-%E4%BF%AE%E6%94%B9-mysql-%E5%AF%86%E7%A2%BC%E8%88%87-phpmyadmin-%E8%A8%AD%E5%AE%9A.html

xampp tutorial

https://premium.wpmudev.org/blog/setting-up-xampp/?tchv=b&utm_expid=3606929-72.AqocGS0YR5Gn_p3r6t6_AA.1&utm_referrer=https%3A%2F%2Fwww.google.com.tw%2F#

Troubleshooting

port 被佔住

1. netstat -aon
2. 工作管理員 -> 詳細資料 -> 結束PID

無法從外部網路連接

- pppoe?
- 控制台 -> 系統及安全性 -> windows防火牆 -> 進階選項 -> 輸入規則

AWS - 不用credentials存取S3的方法

注意事項

  • IAM role不能指派給running instance
  • 如果要加IAM role 給running instance,可以先新增一個instance的image,並指派role給該image後,使用該image啟動一個instance

步驟

  • Create an IAM Role
  • Launch an EC2 Instance and Specify Your IAM Role
  • Create your Application
  • Transfer the Compiled Program to Your EC2 Instance
  • Run the Sample Program on the EC2 Instance

Read More

使用Python驗證AWS EC2是否有權限存取S3

Snippet

import boto3

# Let's use Amazon S3
s3 = boto3.resource('s3')

# Print out bucket names
for bucket in s3.buckets.all():
print(bucket.name)

bucketName = 'my_domain.com.tw'
bucket = s3.Bucket(bucketName)
# 印出bucket下所有物件
for obj in bucket.objects.all():
print(obj.key)

# 指定一個物件,取出後存成test
objName = 'bucket_obj/a_obj'
s3.Object(bucketName,objName).download_file('test')

Step by Step

如果沒有安裝過boto3的話

sudo pip instal boto3

Read More

更改 Linux 預設時區

查詢時區及正式名稱

可以使用wiki https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

在linux裡搜尋相對應的時區

$ ls /usr/share/zoneinfo/
Africa/ CET Etc/ Hongkong Kwajalein Pacific/ ROK zone.tab
America/ Chile/ Europe/ HST Libya Poland Singapore Zulu
Antarctica/ CST6CDT GB Iceland MET Portugal Turkey
Arctic/ Cuba GB-Eire Indian/ Mexico/ posix/ UCT
Asia/ EET GMT Iran MST posixrules Universal
Atlantic/ Egypt GMT0 iso3166.tab MST7MDT PRC US/
Australia/ Eire GMT-0 Israel Navajo PST8PDT UTC
Brazil/ EST GMT+0 Jamaica NZ right/ WET
Canada/ EST5EDT Greenwich Japan NZ-CHAT ROC W-SU

使用soft link方式更改時區會比直接copy還要好維護

$ sudo unlink /etc/localtime
$ sudo ln -s /usr/share/zoneinfo/Etc/GMT+6 /etc/localtime

檢查是否正確更改

$ date -u
Thu Jan 23 05:40:31 UTC 2014

$ date
Wed Jan 22 23:40:38 GMT+6 2014

Reference