Skip to content

Instantly share code, notes, and snippets.

View kimisme9386's full-sized avatar

Chris Yang kimisme9386

View GitHub Profile
@kimisme9386
kimisme9386 / linux-trick-tips.sh
Last active June 21, 2023 09:00
Linux or mac 指令小技號備忘
# 例如要搜尋第一個符號 "[git tag" 開頭且結尾是 "]" 字元的字串,而且用非貪婪的 regular expression 方式,grep 中要加 "-P" 參數
# Linux
grep -o -P "\[git tag .*?\]"
# MacOS 只能用 egrep ,因為 grep 沒有 "-P" 參數
egrep -o "\[git tag .*?\]"
# 執行成功顯示訊息用 "&&" 串起來,若失敗用 "||" 接著串,潔簡的表達成功或失敗該顯示什麼訊息或執行什麼指令
npx projen build && echo "::set-output name=conclusion::success" || echo "::set-output name=conclusion::failure"
@kimisme9386
kimisme9386 / sample.ts
Created April 27, 2021 09:19
CDK Get Secret Manager
import * as cdk from '@aws-cdk/core';
/**
* Using other type of secrets of AWS Secrets Manager
*/
const gitHubToken = cdk.SecretValue.secretsManager('arn:aws:secretsmanager:ap-northeast-1:your account id:secret:cusotm-name-YWWmII', {
jsonField: 'your key name',
})
@kimisme9386
kimisme9386 / url.js
Created October 23, 2016 03:42
JS get url request
var urlRequest = "";
if (window.location.port) {
urlRequest = window.location.protocol + "//" + window.location.host + ":" + window.location.port + window.location.pathname;
} else {
urlRequest = window.location.protocol + "//" + window.location.host + window.location.pathname;
}
@kimisme9386
kimisme9386 / git_hook_repo_name_to_aws_codecommit.sh
Created February 18, 2016 07:08
git hook post recevice for sync to aws codecommit
#!/bin/bash
AWS_CODECOMMIT_URL="git-codecommit.us-east-1.amazonaws.com/v1/repos"
if [ $(git rev-parse --is-bare-repository) = true ]
then
REPOSITORY_BASENAME=$(basename "$PWD")
REPOSITORY_DIRNAME=$(basename $(dirname "$PWD"))
else
REPOSITORY_BASENAME=$(basename $(readlink -nf "$PWD"/..))
@kimisme9386
kimisme9386 / test.css
Last active October 4, 2015 06:41
css media query range
@Media (min-width: 1200px) {
}
@Media (min-width: 980px) and (max-width: 1199px) {
}
/* 平板電腦、橫向手機和一般桌機解析度 */
@Media (min-width: 768px) and (max-width: 979px) {
<?php
$ftpHost = ''; //ftp主機名稱
$ftpId = ''; //ftp帳號
$ftpPwd = ''; //ftp密碼
$remote_file = preg_replace('/\?|:|\/|\\\|\*|"|\||<|>/', '', $remote_file);
//$remote_file = iconv('UTF-8','BIG5',$remote_file);
$remote_file = iconv('UTF-8','gb2312',$remote_file);
$ftpDir = '';
$remote_send_file = $ftpDir.trim($remote_file); //傳到遠端的檔名
<?php
/*
* Plugin: StreamlineFoundation
*
* Class: Schedule
*
* Description: Provides scheduling mechanics including creating a schedule, testing if a specific moment is part of the schedule, moving back
* and forth between scheduled moments in time and translating the created schedule back to a human readable form.
*
* Usage: ::fromCronString() creates a new Schedule class and requires a string in the cron ('* * * * *', $language) format.