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
"""Delete old Slack messages at specific channel.""" | |
from datetime import datetime | |
from time import sleep | |
import json | |
import re | |
import sys | |
import urllib.parse | |
import urllib.request | |
DELETE_URL = "https://slack.com/api/chat.delete" |
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
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
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
javascript:(function(){const titleTag=document.getElementsByTagName("title"),pageUrl=location.href;let pageTitle=pageUrl;titleTag.length>0&&titleTag[0].innerHTML!==""&&(pageTitle=titleTag[0].innerHTML);const md=`[${pageTitle}](${pageUrl})`;navigator.clipboard&&navigator.clipboard.writeText(md);})(); |
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
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
import json | |
import traceback | |
from datetime import datetime, timezone, timedelta | |
from urllib.request import Request, urlopen | |
SLACK_WEBHOOK_URL = '<your-slack-incomming-webhook-url>' | |
SLACK_CHANNEL = '<your-slack-channel>' | |
TEST_EVENT_FILE = './sample__CodeBuild.json' | |