Skip to content

Instantly share code, notes, and snippets.

View yysu's full-sized avatar
🏠
Working from home

Jim yysu

🏠
Working from home
  • Taipei, Taiwan
View GitHub Profile
@yysu
yysu / profile.json
Last active January 12, 2025 02:01
profile.json
{
"public_identifier": "yysu",
"profile_pic_url": "https://s3.us-west-000.backblazeb2.com/proxycurl/person/yysu/profile?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=0004d7f56a0400b0000000001%2F20250112%2Fus-west-000%2Fs3%2Faws4_request&X-Amz-Date=20250112T014555Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=6c6009d2fe4cf1fb1b883860556a69c04e5b948c24814f9bdbfc891e9d012346",
"background_cover_image_url": null,
"first_name": "\u5f65\u6600",
"last_name": "\u8607",
"full_name": "\u5f65\u6600 \u8607",
"follower_count": 541,
"occupation": "Software Engineer at Fortinet",
"headline": "CKAD/CKA/CKS/AWS All-5 certified DevOps",
@yysu
yysu / gist:fe1756a57e03dc50e7cb2de4af194044
Last active December 15, 2021 10:09
AWS EKS aws-iam-authenticator - curl API Server
# Fill these variable
CLUSTER_NAME=<cluster-name>
AWS_DEFAULT_REGION=<region>
B64_CLUSTER_CA=$(aws eks describe-cluster \
--region=${AWS_DEFAULT_REGION} \
--name=${CLUSTER_NAME} \
--output=text \
--query 'cluster.{certificateAuthorityData: certificateAuthority.data}' | base64 --decode)
@yysu
yysu / medium-stat.md
Last active June 12, 2021 08:15
Medium Stat Box

@yysu 81 Followers 🕴 Latest Articles 👇 AWS Copilot 深入淺出 教學 👏 45 AWS Copilot 介紹 實際上手 教學 👏 91 職場新鮮人 — 於 AWS Cloud Suppo... 👏 61

@yysu
yysu / detect-s3-public-bucket.py
Created April 1, 2020 02:40
detect-s3-public-bucket
import json
import sys
import logging
import boto3
from botocore.exceptions import ClientError
def check_acl(s3_client, bucket, all_public_bucket):
public_URI = 'http://acs.amazonaws.com/groups/global/AllUsers'
try:
acl = s3_client.get_bucket_acl(Bucket=bucket)
@yysu
yysu / DateTo5479.py
Last active October 9, 2019 16:28
DateTo5479.py
from dateutil import rrule
from datetime import date,timedelta
def get_days(array):
new_data_list = []
start = date(2000, 1, 1)
for index, value in enumerate(array):
this_day = date(int(str(value)[0:4]), int(str(value)[4:6]), int(str(value)[6:]))
new_date = get_working_days(start, this_day)
new_data_list.append(new_date)
@yysu
yysu / go_through_folder.py
Created December 1, 2018 09:58
遍歷資料夾
import os
# 第一種
path = ""
file_path_list = [ os.path.join(root, file_name) for root, dirs, files in os.walk(path) for file_name in files ]
file_name_list = [ file_name for root, dirs, files in os.walk(path) for file_name in files ]
print(file_path_list)
# 第二種
@yysu
yysu / unzip_all.py
Created May 29, 2018 08:15 — forked from kalkulus/unzip_all.py
PYTHON: unzip all files in a directory
#!/usr/bin/python
import os, zipfile
for filename in os.listdir("."):
if filename.endswith(".zip"):
print filename
name = os.path.splitext(os.path.basename(filename))[0]
if not os.path.isdir(name):
try:
zip = zipfile.ZipFile(filename)
@yysu
yysu / incept-minikube.sh
Created April 22, 2018 04:31 — forked from osowski/incept-minikube.sh
Install Minikube, Kubectl, and Virtualbox on Ubuntu
#Installing VirtualBox
echo "Installing VirtualBox........................"
sudo apt-get install virtualbox
#Installing kubectl https://kubernetes.io/docs/getting-started-guides/kubectl/
echo "Installing kubectl..........................."
wget https://storage.googleapis.com/kubernetes-release/release/v1.4.4/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/kubectl
import zipfile
file_name = ['FUNDH1080D1712200050.zip', 'TWH1130D1712181801.zip']
for name in file_name:
zip_ref = zipfile.ZipFile(name, 'r')
zip_ref.extractall('./')
zip_ref.close()
@yysu
yysu / gist:4972eec0f4e86c4287eae940ed26ab70
Last active October 6, 2023 03:45
自動更新本地資料夾(與ftp server比對)
from ftplib import FTP
import os, sys, string, datetime, time
import shutil
import socket
def syncupAll(path, ftp):
global update_data_list
# 列出所有目前的文件和目錄
filelist = os.listdir(path)