Skip to content

Instantly share code, notes, and snippets.

View masakuni-ito's full-sized avatar

masakuni masakuni-ito

View GitHub Profile
@masakuni-ito
masakuni-ito / archive_updated_file.js
Last active April 24, 2020 02:43
Archive updated file for GAS
function archiveUpdatedFile() {
var orgFileId = PropertiesService.getScriptProperties().getProperty('ORG_FILE_ID')
var destFolderId = PropertiesService.getScriptProperties().getProperty('DEST_FOLDER_ID')
var orgFile = DriveApp.getFileById(orgFileId)
var destFolder = DriveApp.getFolderById(destFolderId)
var yesterday = new Date(new Date().setDate(new Date().getDate() - 1));
var destFileName = Utilities.formatDate(yesterday, 'JST', 'yyyyMMdd') + '_memo'
@masakuni-ito
masakuni-ito / i_love_sessha_1.py
Created December 20, 2019 16:03
A crawler that collects events held in Shizuoka.
import sys
import csv
import re
import math
from time import sleep
from pyquery import PyQuery as pq
def parse(link: str):
row = []
title = ''
#!/usr/bin/env perl
open(FP, "< data.txt") or die("Error");
my @migrations = split(/Table name: .*?Migration File: /s, join('', <FP>));
close(FP);
my $cnt = 1;
my %files = ();
foreach my $migration (@migrations) {
@masakuni-ito
masakuni-ito / rehash_chrome_bookmarks.py
Created January 10, 2019 16:49
Google Cromeのブックマークをwebloc形式のファイルに出力する
#!/usr/bin/env python3
import os
import shutil
import datetime
import json
CHROME_BOOKMARKS = '/Users/ito_masakuni/Library/Application Support/Google/Chrome/Default/Bookmarks'
TARGET_DIR = '/Users/ito_masakuni/Desktop/misc/etc/chrome/bookmarks'
@masakuni-ito
masakuni-ito / rtm.coffee
Created September 4, 2017 06:30
hubot用RTMメール送信
child_process = require 'child_process'
module.exports = (robot) ->
sendEmail = (to, subject, msg, from, recipients='') ->
mailArgs = ['-s', subject, '-r', "#{from}", '-S', "From: #{from}", "#{to}"]
mailArgs = mailArgs.concat recipients
p = child_process.execFile '/usr/bin/mail', mailArgs, {}, (error, stdout, stderr) ->
console.log 'stdout: ' + stdout
console.log 'stderr: ' + stderr
p.stdin.write "#{msg}\n"
@masakuni-ito
masakuni-ito / junk
Last active November 20, 2018 15:40
指定したディレクトリのファイルをアーカイブする
#!/bin/sh
FROM="your_nice_mail@example.com"
TO="your_nice_mail@example.com"
TARGET_DIRS=("/Users/example/.Trash" "/Users/example/Desktop/work/tmp" "/Users/example/Downloads")
ARCHIVE_DIR=/Users/example/Desktop/misc/archives
TMP_DIR=/tmp/`date "+%Y%m%d%H%M%S"`_junk
BODY=""