This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: "2010-09-09" | |
Description: "Setup API Gateway custom domain name" | |
Parameters: | |
AcmArn: | |
Type: String | |
CustomDomainName: | |
Type: String | |
ApiID: | |
Type: String | |
DomainHostZoneId: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
import boto3 | |
import json | |
import logging | |
import re | |
import traceback | |
import urllib.parse | |
import urllib.request | |
import xml.etree.ElementTree as ET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){ if (location.href.match(/^https/)) { htb = 'https://b.hatena.ne.jp/entry/s/' + location.href.replace(/https?:\/\//g, ''); } else { htb = 'https://b.hatena.ne.jp/entry/' + location.href.replace(/https?:\/\//g, ''); } window.open(htb, '_blank');})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from urllib.request import Request, urlopen | |
SLACK_WEBHOOK_URL = '<YOUR-SLACK-WEBHOOK-URL>' | |
def lambda_handler(event, context): | |
try: | |
if 'debug' in event: | |
event_message = event['debug'] | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){tit=document.querySelector('.trackInfoContainer .trackTitle a span').innerText;artO=document.querySelector('.trackInfoContainer .trackArtist span');if(typeof artO == 'undefined') {artO=document.querySelector('.trackInfoContainer .trackArtist span.artist');}art=artO.innerText;window.prompt('NowPlaying!', `${tit}/${art} #NowPlaying`);})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
from urllib import request | |
import re | |
import sys | |
import traceback | |
if __name__ == "__main__": | |
args = sys.argv | |
if len(args) < 2: | |
print('At least one argument is required.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function showInfoNotifiesOldPost() { | |
const nowDate = new Date(); | |
const oldTs = 60 * 60 * 24 * 365 * 1000; // 1 year (millisecond) | |
const nowTs = nowDate.getTime(); | |
const postDateElem = document.querySelector('p.post-date > time.dt-published'); | |
if (postDateElem !== null) { | |
try { | |
const postDateStr = postDateElem.getAttribute('datetime'); | |
const postDate = new Date(postDateStr); | |
const postTs = postDate.getTime(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from urllib import request | |
from urllib.request import Request, urlopen | |
def save_image(img_url): | |
""" | |
Save images from image url to S3 backet. | |
@param string img_url | |
""" | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Draggable Block Test</title> | |
<style> | |
.outer-block { | |
position: relative; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################### | |
# check process aliving (count process number) | |
# return integer 1 (process is running) or 0 (process is dead) or 9 (some error) | |
################################################################################### | |
function is_process_alive() { | |
count=`ps awux | grep -v grep | grep -v "$0" | grep -w "$1" | wc -l` | |
if [[ $count =~ ^[0-9]+$ ]]; then | |
if [ $count != 0 ]; then | |
echo 1 | |
else |