Skip to content

Instantly share code, notes, and snippets.

View dinos80152's full-sized avatar

Dino Lai dinos80152

View GitHub Profile
@dinos80152
dinos80152 / s3_usage_report.py
Created November 19, 2020 10:27
Generate S3 Usage Report
# check unused s3 bucket by compare min and max number of objects
import boto3
from datetime import datetime
import csv
START_TIME = datetime(2019, 3, 1)
END_TIME = datetime(2019, 6, 1)
#!/usr/bin/python
import sys
import os
import boto3
from pprint import pprint
from functools import reduce
# export AWS_ACCESS_KEY_ID=
# export AWS_SECRET_ACCESS_KEY=
# export AWS_DEFAULT_REGION=
class VoiceTube {
answer() {
if (document.querySelector('.title_info').textContent.includes('影片理解')) {
this.comprehension()
document.querySelector('.check_ans').click()
if (document.querySelector('.next_question') !== null) {
document.querySelector('.next_question').click()
}
if (document.querySelector('.go_game') !== null) {
document.querySelector('.go_game').click()
@dinos80152
dinos80152 / MobileValidator.php
Last active August 29, 2015 14:28
A little bit functional
<?php
namespace App\Validators;
class MobileValidator
{
public function validate($attribute, $number, $countries)
{
try {
@dinos80152
dinos80152 / chain.php
Created July 6, 2015 09:48
chain or not
<?php
//1
public function listByTagGroup($tag_group_id)
{
return FaqTagGroup::find($tag_group_id)->faqTags->reduce(function ($carry, $faq_tag) {
return $carry->merge($faq_tag->faqs);
}, collect());
}
function send_msg(){
var msg = document.getElementById("msg").value;
var telecom = document.getElementById("telecom").value;
var type = document.getElementById("type").value;
var file_name = document.getElementById('server_file_name').value;
var xhr = new XMLHttpRequest();
xhr.open('POST','sms_send.php',true);
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhr.onload = function(e){