Skip to content

Instantly share code, notes, and snippets.

View atsukoba's full-sized avatar
😀
I am the walrus

Atsuya Kobayashi atsukoba

😀
I am the walrus
View GitHub Profile
@atsukoba
atsukoba / 1-dim steepest descent.py
Created January 25, 2018 15:27 — forked from matsuken92/1-dim steepest descent.py
Various types of gradient descent method
import numpy as np
import matplotlib.pyplot as plt
from moviepy.editor import *
from matplotlib import animation as ani
sigma = 1
mu = 3
def norm_dist_neg(x):
return -1./(np.sqrt(2 * np.pi) * sigma)* np.exp(-0.5*((x-mu)**2)/((sigma**2)))
@atsukoba
atsukoba / nb_table_generator.py
Last active March 3, 2024 20:58
Extract Table of contents from Jupyter Notebook files
import os
import json
from glob import glob
from itertools import chain
from datetime import datetime
sep = os.path.sep
def extract_md(file: str) -> list:
@atsukoba
atsukoba / document_SVClassifier.py
Last active February 15, 2019 09:00
Simple Document Classifier (doc2vec + SVM + optuna)
# Author: Atsuya Kobayashi @atsuya_kobayashi
# 2019/02/15 17:20
"""Support Vector Document Classifier with doc2vec & Optuna
- .csv label file must be in the form of following style
|DOCUMENT_FILE_NAME(id)|LABEL(labels)|
@atsukoba
atsukoba / .jupyter-custom-custom.css
Created June 24, 2019 01:30
Custom CSS for Jupyter Notebook
/* ################################
custom.css written below 2018/08/12
################################ */
/* change markdown inline code style */
.rendered_html code {
background-color: #d5eaff;
margin: 0px 2px;
@atsukoba
atsukoba / gitprompt.sh
Created June 28, 2019 21:42
Git Branch Extention for bash prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ [\1]/'
}
export PS1="\n\[\e[0;37m\][\#(\!)] \[\e[0;33m\]\t \[\e[0;34m\]\u \[\e[0;37m\]at \[\e[0;31m\]\w\[\e[0;37m\]\[\e[1;37m\]\$(parse_git_branch)\[\e[1;37m\]\n\[\e[0;36m\]--> \[\e[0m\]"
@atsukoba
atsukoba / gorgeous.py
Last active July 19, 2019 19:07
宇宙海賊ゴー☆ジャス
import re
import MeCab
import wikipedia
import logging
import shutil
from logging import getLogger
from pykakasi import kakasi
from Levenshtein import distance as D
logging.basicConfig(level=logging.INFO)
@atsukoba
atsukoba / flask_on_ngrok_qr.sh
Last active August 27, 2019 15:32
Run python flask app on tmux session and get QR code for ngrok public URL
if !(type "pip3" > /dev/null 2>&1); then
echo "install pip..."
brew install python
fi
pip3 install -r requirements.txt
echo "Create tmux session for python api"
tmux new-session -d -s python_api 'python3 run.py'
if !(type "jq" > /dev/null 2>&1); then
@atsukoba
atsukoba / functions.php
Created November 13, 2019 20:07
WordPress login page (/wp-login.php) logo customize
// add to functions.php
function custom_login() {
$style = '
<style>
.login > #login > h1 > a {
background-image: url(PATH/TO/IMAGE.png);
background-size: 100%;
width: 100%;
height: 100px;
}

SEO

All in One SEO Packでmetaタグ挿入,https://search.google.com/search-consoleでの検索最適化

  • sitemapの登録とping

XML Sitemap Generator for WordPressを用いるが,この際に「html形式のサイトマップを含める」のチェックを外すこと(search console上でxml外の形式だとエラーが出るため)

@atsukoba
atsukoba / cssAnimationUsingElementWidth.coffee
Created January 8, 2020 11:39
animation with element width value sample
# animation with element width value sample with JQuery
# generate style dom
generateCss = (name, diff) ->
# sample: marquee like animation
style = $("
<style>
@keyframes #{name} {
0% {
transform: translate(0%);
}