Skip to content

Instantly share code, notes, and snippets.

@sleepless-se
sleepless-se / toJpDateTimeFromISO8601String
Created January 18, 2018 10:23
you can comvert ISO8601 String to Japan datetime. if you delete line 8 you can use as ISO8601 String converter.
from datetime import date
dt="2017-09-10T07:16:50Z"
import datetime
import dateutil.parser
def toJpDateTimeFromISO8601String(s):
d = dateutil.parser.parse(s)
d = d + datetime.timedelta(hours=9)
return d
@sleepless-se
sleepless-se / CleanDesktopAndDownload.py
Last active January 18, 2018 15:06
Clean your mac of desktop and download folder.
import os
import datetime
import shutil
desktop_path = os.environ['HOME'] + "/Desktop/"
downloads_path = os.environ['HOME'] + "/Downloads/"
days = 7
oldF_folder = "old/"
def moveOldFiles(current_path,oldFolder,dasy):
@sleepless-se
sleepless-se / getYesterDay()
Last active January 18, 2018 14:23
[python] Get japan yesterday timedate as string
from datetime import datetime
def getYesterDay():
JST = timezone(timedelta(hours=+9), 'JST')
d = datetime.now(JST)
yesterday = str(d.year) +"-"+ str(d.month) +"-"+ str(d.day-1)
print(yesterday)
return yesterday
@sleepless-se
sleepless-se / [python] getMinusDay(days)
Created January 18, 2018 15:04
This method return minus days.
import datetime
def getMinusDay(days):
today = datetime.date.today()
day = datetime.timedelta(days = days)
return today - day
print(getMinusDay(1))
@sleepless-se
sleepless-se / SpeedTest
Created September 17, 2018 08:21
This class for test java process speed.
public class SpeedTest {
private long start = System.currentTimeMillis();
public static void main(String[] args) {
SpeedTest speedTest = new SpeedTest();
// some process
speedTest.stopTimer();
}
@sleepless-se
sleepless-se / moneyforward_reload_account.py
Last active November 15, 2018 14:14
マネーフォワードに登録している金融機関を自動更新するスクリプト
from selenium import webdriver
import logging
import time
import sys
args = sys.argv
_format = "%(asctime)s %(levelname)s %(name)s :%(message)s"
logging.basicConfig(filename="moneyforward_reload_account.log", level=logging.DEBUG, format=_format)
global driver
driver = None
@sleepless-se
sleepless-se / moneyforward_reload_accounts.sh
Created November 15, 2018 14:37
マネーフォワード金融機関情報自動更新用シェルスクリプト
#! /bin/bash
export DISPLAY=':0';
cd スクリプトのディレクトリ;
python3 moneyforward_reload_accounts.py "@gmail.com" "password";
#!/usr/bin/python2
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Virtual Me2Me implementation. This script runs and manages the processes
# required for a Virtual Me2Me desktop, which are: X server, X desktop
# session, and Host process.
# This script is intended to run continuously as a background daemon
# process, running under an ordinary (non-root) user account.
@sleepless-se
sleepless-se / create_access_key_secret.py
Last active March 30, 2024 23:35
This script for create twitter ACCESS TOKEN KEY and ACCESS TOKEN SECRET.
import tweepy
import webbrowser
import urllib
CONSUMER_KEY = "*****"
CONSUMER_SECRET = "*****"
def get_oauth_token(url:str)->str:
querys = urllib.parse.urlparse(url).query