Skip to content

Instantly share code, notes, and snippets.

@nanzono
nanzono / rename from Gsuite files to .txt
Created June 30, 2017 02:36
G Suiteのファイル名を変更
# conding: utf-8
import os
import os.path
target_path = '/path/to/rename/
def main():
cnt = 0
@nanzono
nanzono / Vagrantfile_Py34_CentOS65
Last active August 29, 2015 14:20
Python 3.4系をCentOS 6.5系にインストールする
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/centos-6.5"
config.vm.network :private_network, ip: "192.168.33.31"
config.vm.provision "shell", inline: <<-EOT
@nanzono
nanzono / fbmsg.js
Last active August 29, 2015 14:11
facebook message(web)からコンテンツを引き抜く
javascript:(function()%7Bconsole.log(document.getElementById("webMessengerRecentMessages").innerText)%3B%7D)()%3B
@nanzono
nanzono / reset_yun.ino
Created August 31, 2014 16:40
Arduino側からOpenWRTを呼び出して操作するために
#include <Process.h>
void c_print(Process p){
while(p.available()>0){
char c = p.read();
Serial.print(c);
}
Serial.flush();
}
# coding:utf-8
import os
target_path = './target/'
def main():
for dpath,dnames,fnames in os.walk(target_path):
for fname in fnames:
@nanzono
nanzono / duplicated_finder.py
Created June 27, 2014 08:57
check duplicate rows.
# coding:utf-8
import os
import hashlib
import sqlite3
target_path = './20140620/'
db_path = './logs.db'
file_output = './output.txt'
@nanzono
nanzono / parse_html.js
Last active December 27, 2015 05:59
html要素を取得
var titles = document.getElementsByTagName("title");
var title = (titles.length > 0) ? titles[0].innerHTML: "";
var metas = document.getElementsByTagName("meta");
var description = "";
var keywords = "";
for (i=0; i<metas.length; i++){
var meta_name = metas[i].getAttribute("name");
if (meta_name=="description"){
description = metas[i].getAttribute("content");
} else if (meta_name=="keywords"){
@nanzono
nanzono / scraper.py
Last active December 27, 2015 03:48
how to scrape
# coding:utf-8
from BeautifulSoup import BeautifulSoup
import urllib2
import json
def crawl(tmp_url):
page = urllib2.urlopen(tmp_url)
soup = BeautifulSoup(page.read())
@nanzono
nanzono / adafruit_evernote_strip.js
Created August 15, 2013 09:44
Adafrtuitの商品詳細ページの必要情報だけを残す。evernoteで取り込むために。
var tab_0 = document.getElementById("tab_0");
var tab_1 = document.getElementById("tab_1");
var tab_2 = document.getElementById("tab_2");
var tab_3 = document.getElementById("tab_3");
tab_0.style.display = "";
tab_1.style.display = "";
tab_2.style.display = "";
tab_3.style.display = "";
@nanzono
nanzono / get_days.py
Created July 23, 2013 03:35
80歳が寿命だとして。
# coding:utf-8
import datetime
def print_days(birth_year, birth_month, birth_day, target_year):
birth_day = datetime.date(birth_year, birth_month, birth_day)
today = datetime.date.today()
last_day = datetime.date(birth_day.year + target_year, birth_day.month, birth_day.day)
print last_day