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
# -*- coding: utf-8 -*- | |
import tweepy | |
import sqlite3 | |
import time | |
username = '' | |
password = '' | |
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
# -*- coding: utf-8 -*- | |
import sqlite3 | |
import time | |
import MeCab | |
def connect_db(): | |
conn = sqlite3.connect('tl.db') | |
return conn |
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
# -*- coding: utf-8 -*- | |
import sys | |
import tweepy | |
from pit import Pit | |
def get_api(): | |
token = Pit.get('tw_oauth') | |
auth = tweepy.OAuthHandler(consumer_key = token['consumer_key'], consumer_secret = token['consumer_secret']) | |
auth.set_access_token(key = token['access_token'], secret = token['access_token_secret']) |
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
# -*- coding: utf-8 -*- | |
#anime.py | |
import urllib2, MeCab | |
from BeautifulSoup import BeautifulSoup | |
from math import sqrt | |
import clusters | |
url = 'http://ja.wikipedia.org/wiki/%E6%A9%9F%E5%8B%95%E8%AD%A6%E5%AF%9F%E3%83%91%E3%83%88%E3%83%AC%E3%82%A4%E3%83%90%E3%83%BC%E3%81%AE%E7%99%BB%E5%A0%B4%E4%BA%BA%E7%89%A9' |
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 time, calendar | |
t = 'Mon Aug 09 16:26:19 +0000 2010' | |
utime = time.strptime(t,'%a %b %d %H:%M:%S +0000 %Y') | |
jtime = time.localtime(calendar.timegm(utime)) | |
return time.strftime('%Y%m%d%H%M%S',jtime) |
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 dateutil import zoneinfo | |
def utc_to_jst(utc): | |
tz = zoneinfo.gettz('Asia/Tokyo') | |
_utc = utc.replace(tzinfo=tz) | |
return tz.fromutc(_utc) |
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
(require 'org) | |
(require 'org-pomodoro) | |
(require 'json) | |
(require 'request) | |
(defconst org-recodoro "0.0.1" | |
"The version of the org-recodoro lisp code.") | |
(defgroup org-recodoro nil | |
"Record your pomodoro through API and see your achievements." |
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 typing import TYPE_CHECKING | |
if TYPE_CHECKING: | |
from typing import List, Callable, TypeVar, Optional | |
T = TypeVar('T') | |
def test(func: Callable[[str], T]) -> List[T]: | |
list(map(func, "1")) |
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 pathlib import Path | |
from typing import Iterable, Iterator | |
import tempfile | |
import shutil | |
_basepath = Path("") | |
def glob_files() -> Iterator[Path]: | |
files = _basepath.rglob("*.py") |
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
export const testtransaction = async () => { | |
const counterDoc = await customerTotalCounterRef().get() | |
const counter = counterDoc.data() as customerCounter | |
console.warn('before') | |
console.warn(counter.count) | |
try { | |
await db.runTransaction(async transaction => { | |
await transaction.update(customerTotalCounterRef(), { | |
count: firebaseApp.firestore.FieldValue.increment(1), | |
}) |