Skip to content

Instantly share code, notes, and snippets.

View stefango's full-sized avatar
🎯
Focusing

stefango

🎯
Focusing
View GitHub Profile
@stefango
stefango / gist:ac4dee87dd380d2e61447340c71803f3
Created January 16, 2020 08:22
wget Unable to establish SSL connection
https://raw.staticdn.net/
跃然纸上
@stefango
stefango / go.sh
Created April 7, 2020 10:06
Scripts to install v2ray
#!/bin/bash
# This file is accessible as https://install.direct/go.sh
# Original source is located at github.com/v2ray/v2ray-core/release/install-release.sh
# If not specify, default meaning of return value:
# 0: Success
# 1: System error
# 2: Application error
# 3: Network error
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1440' height='461' viewBox='0 0 1440 461'%3E %3Cdefs%3E %3ClinearGradient id='a' x1='47.52%25' x2='105.613%25' y1='46.504%25' y2='40.293%25'%3E %3Cstop offset='0%25' stop-color='%23945DFF'/%3E %3Cstop offset='44.95%25' stop-color='%23C34CBB'/%3E %3Cstop offset='78.7%25' stop-color='%23E1418E'/%3E %3Cstop offset='95.7%25' stop-color='%23ED3D7D'/%3E %3C/linearGradient%3E %3ClinearGradient id='b' x1='103.217%25' x2='-128.059%25' y1='44.009%25' y2='67.169%25'%3E %3Cstop offset='0%25' stop-color='%23FCEE39'/%3E %3Cstop offset='100%25' stop-color='%23F37B3D'/%3E %3C/linearGradient%3E %3ClinearGradient id='c' x1='-48.456%25' x2='83.191%25' y1='84.04%25' y2='39.31%25'%3E %3Cstop offset='0%25' stop-color='%23FCEE39'/%3E %3Cstop offset='100%25' stop-color='%23F37B3D'/%3E %3C/linearGradient%3E %3ClinearGradient id='d' x1='0%25' y1='50%25' y2='50%25'%3E %3Cstop offset='0%25' stop-color='%23EF5A6B'/%3E %3Cstop offset='36.4%25' stop-
@stefango
stefango / getCode.js
Created June 29, 2020 05:18
获取验证码片段
getCode() {
this.isLoading = true
this.isDisable = true
let time = 10;
this.getCodeButtonValue = time + '秒后重试'
let task = setInterval(() => {
time--;
this.getCodeButtonValue = time + '秒后重试'
console.log("task - " + time)
}, 1000)
@stefango
stefango / freeme.sh
Created October 31, 2020 08:06
autochange elastic ips by aws cli 2
# ref: https://wangfanggang.com/AWS/aws-cli-renew-ip/
FilterStr="Name=tag-key,Values=ec2"
# get ec2 instance id by tag
InstanceId=$(aws ec2 describe-instances --filters $FilterStr --query "Reservations[*].Instances[*].[InstanceId]" --output text)
OldPublicIpAddress=$(aws ec2 describe-instances --filters $FilterStr --query "Reservations[*].Instances[*].[PublicIpAddress]" --output text)
# generate an elastic ip address
NewPublicIpAddress=$(aws ec2 allocate-address --domain vpc --query "PublicIp" --output text)
@stefango
stefango / getPageStoreInfo.js
Last active November 15, 2020 08:02
Get store info of this page
Object.keys(this).filter(key=>key.match(/[sS]tore/))
Object.keys(this).forEach((e)=>{e.match(/[sS]tore/)?console.log(e):'';})
const resizeObserver = new ResizeObserver(entries => {
for (let entry of entries) {
entry.target.style.borderRadius = Math.max(0, 250 - entry.contentRect.width) + 'px';
}
console.log('resized')
});
resizeObserver.observe($('#jquery-div')[0]);
resizeObserver.observe($(document.getElementById('raw-div'))[0]);
let value = "2020-12-01 17:00"
//let value = "17:00"
//let value = "00:00"
let timeReg = /^(0?[0-9]|1[0-9]|2[0-3]):(0?[0-9]|[1-5][0-9])$/gi;
let dateReg = /^[1-2]\d{3}\-(0[1-9]|1[0-2])\-(0[1-9]|[1-2][0-9]|3[0-1])$/gi;
let isDateTime = false;
let arr = value.split(" ");
if (arr.length==2 && dateReg.test(arr[0]) && timeReg.test(arr[1])) {
isDateTime = true;
}
@stefango
stefango / destructing.js
Last active December 27, 2020 07:32
js 解构赋值
let arr = [5,6,7]
let [a] = arr // a: 5
let obj = {'age': 21, 'name': 'xzl'}
let {name, age} = obj // name: "xzl",age: 89
// 数组解构按顺序赋值,对象解构按key赋值