Skip to content

Instantly share code, notes, and snippets.

@cloverrose
cloverrose / Vagrantfile
Last active December 22, 2015 23:29
forwarded_port設定
# -*- 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|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# -*- mode: ruby -*-
# vi: set ft=
# 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|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# -*- 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|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# -*- 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|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@cloverrose
cloverrose / square_image_nogif.py
Last active December 21, 2015 04:18
画像を正方形にトリミング・リサイズする。PIL(Pillow)を使っている。現在gifは上手く扱えない。 ImageMagick(Wand)を使った方はgifも適切に扱える。
# -*- coding:utf-8 -*-
"""
静的ファイルに関するユーティリティ群(PIL系 gifはうまく扱えない)
"""
import urllib
import contextlib
from PIL import Image
def download_image(url, filename):
@cloverrose
cloverrose / jpegmini_rename.py
Created July 29, 2013 09:45
JPEGminiで圧縮したファイルのファイル名を_mini.jpgから.jpgにリネームするスクリプト
# -*- coding:utf-8 -*-
"""
JPEG miniで小さくしたファイルの_mini.jpgを.jpgにリネームするスクリプト
"""
import os
from os.path import join
def main():
for root, dirs, files in os.walk('.'):
@cloverrose
cloverrose / liteweight.el
Created July 5, 2013 06:10
Emacsで大きいファイルを開くとき用の関数
(defun liteweight()
"to read large file."
(interactive)
(progn
(setq ac-auto-start nil)
(setq show-paren-mode nil)
(global-linum-mode -1)
(line-number-mode 1)
(global-whitespace-mode -1)
(disable-theme 'aria)
@cloverrose
cloverrose / django_with_handlebars.html
Created June 24, 2013 11:42
Django 1.5 introduced {% verbatim %} template tag. It stops template from parsing contents of this tag.
<html>
<head>
</head>
<body>
Welcome {{ name }}!!
<div id="container"></div>
{% verbatim %}
<script type="text/x-handlebars-template" id="mytemplate">
<h2>{{ message }}</h2>
@cloverrose
cloverrose / copy.py
Created June 18, 2013 15:36
gitのfilter-branchとかで使ったスクリプト
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os.path
import shutil
def main(source, target):
print('\n\n[INFO] start copy {0} to {1}'.format(source, target))
if os.path.isfile(target):
try:
@cloverrose
cloverrose / sq.py
Created June 16, 2013 07:53
draftcode sensei test
# -*- coding:utf-8 -*-
def main(s, a):
ret = ''
flg = False
for i in s:
if i != a:
ret += i
flg = False
elif not flg:
ret += i