Skip to content

Instantly share code, notes, and snippets.

@nozma
nozma / custom_css.css
Created April 30, 2018 07:11
custom css for discord.app
.message-group .comment .markup {
/* for Japanese language */
/* require IPAexGothic font */
font-family: 'IPAexGothic';
line-height: 1.6;
}
@nozma
nozma / main.py
Created April 22, 2018 13:35
my first discord bot
import os
import random
import numpy as np
from discord.ext import commands
BOT_PREFIX = ("?", "!")
client = commands.Bot(command_prefix=BOT_PREFIX)
@nozma
nozma / 01_intro.md
Created April 13, 2018 22:49
第1章 イントロダクション

第1章 イントロダクション

This is introduction!

本書の構成

  • 第1部: まず入門だ!
  • 第2部: OOPだ!
  • 第3部: ツールの話だ!
  • 第4部: サイエンスだ!
@nozma
nozma / Dockerfile
Last active March 18, 2018 00:15
ローカルのRStudioの設定をDockerコンテナ上のRStudio Serverに反映する ref: https://qiita.com/nozma/items/cae323708ff60cc2f67a
FROM rocker/rstudio
RUN mkdir -p /home/rstudio/.rstudio/monitored/user-settings/
RUN chown -R rstudio:rstudio /home/rstudio/.rstudio
@nozma
nozma / file0.r
Last active December 28, 2017 13:18
Rでフロイドの循環検出法を可視化する ref: https://qiita.com/nozma/items/bfa3e089cd432b74c10d
## フロイドの循環検出法を可視化する ----
library(dplyr)
library(igraph)
library(ggplot2)
library(GGally)
library(ggnetwork)
#devtools::install_github("dill/emoGG")
library(emoGG)
make_rho_graph <- function(lambda, mu, type = "network"){
" general
set autoupdategist " gistの設定を自動反映
let scrollstep = 150
let fullpagescrollpercent = 100
set smoothscroll
set noautofocus " サイトを開いた時に入力欄にフォーカスが奪われるのを抑止
let searchlimit = 20
let barposition = "bottom"
@nozma
nozma / Main.py
Last active August 28, 2017 13:56
# coding: utf-8
import random
def gen_typo(S):
return ' '.join(
s
# 長さ4以下の単語はそのまま返す
if len(s) <= 4
# 長さ5以上の単語は1文字目と2文字目を残してシャッフル
@nozma
nozma / Main.py
Last active August 17, 2017 13:13
# coding: utf-8
def cipher(S):
return ''.join(chr(219 - ord(c)) if c.islower() else c for c in S)
S = "abcDe"
print(cipher(S))
print(cipher(cipher(S)))
@nozma
nozma / Main.py
Last active August 17, 2017 13:06
# coding: utf-8
def n_gram(n, s):
return [s[i:i+n] for i in range(0, len(s)-n+1)]
print(n_gram(2, 'I am an NLPer'))
@nozma
nozma / Main.py
Last active August 17, 2017 13:04
# coding: utf-8
s = 'Hi He Lied Because Boron Could Not Oxidize Fluorine. New Nations Might Also Sign Peace Security Clause. Arthur King Can.'
target = 1, 5, 6, 7, 8, 9, 15, 16, 19
result = [w[: 1 if i in target else 2] for i, w in enumerate(s.split(), 1)]
print(result)