Skip to content

Instantly share code, notes, and snippets.

@Cartman0
Cartman0 / histogramからKL.ipynb
Created May 16, 2019 20:41
histogramからKL情報量
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Cartman0
Cartman0 / ホップフィールドネットワーク.ipynb
Created May 14, 2019 14:45
ホップフィールドネットワーク
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Cartman0
Cartman0 / backprop_for_diff
Created May 12, 2019 22:42
backpropで微分値を求める
import scipy as sp
class FB:
def __init__(self):
pass
class Sigmoid:
def __init__(self):
self._output = None
@Cartman0
Cartman0 / 逆誤差伝播.ipynb
Last active May 12, 2019 22:35
逆誤差伝播
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Cartman0
Cartman0 / 正規分布間のKL情報量.ipynb
Last active May 1, 2019 15:57
正規分布間のKL情報量
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Cartman0
Cartman0 / event-scroll-x.js
Last active September 27, 2018 18:33
get scroll-x event on JS
var target = document.getElementsByTagName('main')[0];
var res = document.getElementsByClassName('result')[0];
function createEventScrollX(ele){
this._past_scroll_left = 0;
this.ev_scroll_x = new CustomEvent('scroll-x', {bubbles:true, cancelable:true});
this.dispatch_callback = function(ev){
var cuT = ev.currentTarget;
var now_l = cuT.scrollLeft;
if(now_l !== this.past_scroll_left){
@Cartman0
Cartman0 / add_lastmodDate_into_hatenablog.js
Created November 8, 2017 14:58
はてなブログの各記事に最終更新日を追加するスクリプト
(function(){
/*
- args: lastmod: str
*/
function addLastmod(lastmod){
/* ここでlastmodを追加 */
var time = document.createElement("time");
time.setAttribute("itemprop", "dateModified");
time.setAttribute("title", lastmod);
time.setAttribute("datetime", lastmod);
@Cartman0
Cartman0 / hatena_edit_batch.py
Created October 19, 2017 14:54
はてなAPI 一括編集
def get_soupXML_soupHTML_from_entryid(hatena_id, blog_id, password, entry_id):
'''
return soup(XML) of respose, soup(HTML) content in reponse
'''
member_uri = "https://blog.hatena.ne.jp/{hatena_id}/{blog_id}/atom/entry/{entry_id}".format(hatena_id=hatena_id, blog_id=blog_id,entry_id=entry_id)
res_member = requests.get(member_uri, auth=(hatena_id, password))
if not res_member.ok:
print("status_code: " + str(res_member.status_code))
return False
@Cartman0
Cartman0 / edit.py
Created October 18, 2017 12:43
はてなブログAPI 記事の編集
import requests
import bs4
hatena_id="<hatena_id>"
blog_id="<blog_id>"
password="<api_key>"
entry_id = "8599973812308945752"
member_uri = "https://blog.hatena.ne.jp/{hatena_id}/{blog_id}/atom/entry/{entry_id}".format(hatena_id=hatena_id, blog_id=blog_id,entry_id=entry_id)
@Cartman0
Cartman0 / get_entry_content_str.py
Created October 18, 2017 08:18
はてなブログAPI entry_idから記事のコンテンツ要素(文字列)を取得
import requests
import bs4
def get_entry_content_str(hatena_id, blog_id, password, entry_id):
member_uri = "https://blog.hatena.ne.jp/{hatena_id}/{blog_id}/atom/entry/{entry_id}".format(hatena_id=hatena_id, blog_id=blog_id,entry_id=entry_id)
res_member = requests.get(member_uri, auth=(hatena_id, password))
if not res_member.ok:
print("Failed: status_code: " + str(res_member.status_code))
return False
soup_response_xml = bs4.BeautifulSoup(res_member.content, features="xml")