Skip to content

Instantly share code, notes, and snippets.

import re
import unicodedata
def slugify(value, separator):
""" Slugify a string, to make it URL friendly. """
normalized = unicodedata.normalize('NFKD', value)
v = normalized.strip().lower()
return re.sub('[%s\s]+' % separator, separator, v)
site_name: My Docs
markdown_extensions:
tox:
slugify: !!python/object:myslugify.slugify

My headers

hello

テスト

hello

漢字

hello

全角スペース テスト

#Execute as root
stud -f *,443 -b 127.0.0.1,8080 -u myuser -g mygroup --ssl /path/to/cert_and_key.pem
@hozumi
hozumi / monitrc
Last active December 15, 2015 06:48
monit setting
set daemon 60
set logfile syslog facility log_daemon
set idfile /var/.monit.id
set statefile /var/.monit.state
set mailserver smtp.gmail.com port 587
username "[email protected]" password "mypassword"
using tlsv1
with timeout 30 seconds
set alert [email protected]
set httpd port 2813 address localhost
var xhr = new XMLHttpRequest();
// undefined
xhr.open('POST', 'http://localhost:4000/', true);
// undefined
xhr.onreadystatechange = function (a){console.log(a);}
// function (a){console.log(a);}
xhr.send('{"a":"b"}');
// undefined
// XMLHttpRequest cannot load http://localhost:4000/. Origin http://d.hatena.ne.jp is not allowed by Access-Control-Allow-Origin```
@hozumi
hozumi / util.clj
Last active December 12, 2015 10:28
(defn entity->map [convert-data entity]
(reduce (fn [m attr]
(if (keyword? attr)
(if-let [v (attr entity)]
(assoc m attr v)
m)
(let [[attr conv-fn] attr]
(if-let [v (attr entity)]
(assoc m attr (conv-fn v))
m))))
@hozumi
hozumi / index121.html
Last active December 11, 2015 17:09
less #1152
<!DOCTYPE html>
<html>
<head>
<link href="style.less" rel="stylesheet/less" type="text/css">
<script src="less-1.2.1.js" type="text/javascript"></script>
</head>
<body>
<div id="wrapper" class="webkit-scrollbar-gray">
<div id="main">
hello
a:link { color:#111; text-decoration:none; }
a { color:#111; text-decoration:none; }
a:visited { color:#828282; text-decoration:none; }
@basic-background-color: #fdfdfd;
@basic-font-color: black;
@subtext-font-color: #828282;
@default-font-family: "メイリオ",Meiryo,"Meiryo UI","Segoe UI","ヒラギノ丸ゴ Pro W4",HiraMaruPro-W4,"Hiragino Maru Gothic Pro","ヒラギノ角ゴ Pro W3","Hiragino Kaku Gothic Pro",Osaka,"MS Pゴシック","MS PGothic",Merriweather,Verdana,Helvetica,Arial,Sans-Serif;
body {