Skip to content

Instantly share code, notes, and snippets.

View kurap's full-sized avatar

TetsuyaKurata kurap

View GitHub Profile
@kurap
kurap / gist:11079157
Created April 19, 2014 09:29
image resizing using PythonImagingLibrary(PIL)
class resize:
def __init__(self, input_image):
self.input_image = input_image
self.output_image = StringIO()
def resize_image(self, width=400, height=300, aspecto_width=4, aspect_height=3):
"""
resize image
:param self
:param width default=200px
upstream some_app_server {
server 127.0.0.1:9393;
}
server {
listen 80;
server_name my-upload-endpoint.com ;
@kurap
kurap / vagrant_command
Last active August 29, 2015 14:08
Vagrant command
## vm 起動
vagrant up
## vm 停止
vagrant halt
## vm 休止
vagrant suspend
## vm 削除
@kurap
kurap / Install the nginx for Ubuntu OS
Created November 16, 2014 02:34
Nginx for ubuntu setting.
##### add apt key
## get ther key
http://nginx.org/keys/nginx_signing.key
## create key file
vi nginx_signing.key
## paste key content
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (FreeBSD)
@kurap
kurap / youtube.py
Last active August 29, 2015 14:23 — forked from joanfont/youtube.py
from django import template
import re
register = template.Library()
@register.simple_tag
def youtube_embed(video):
YOUTUBE_REGEX = r'(https?://)?(www\.)?(youtube|youtu|youtube-nocookie)\.(com|be)/(watch\?v=|embed/|v/|.+\?v=)?([^&=%\?]{11})'
def _get_id(video):
@kurap
kurap / WEB fonts
Created November 13, 2013 03:31
WEBフォント比較メモ
Glyphicons
http://glyphicons.com/
・基本的なCSSが入っているが、サイトに合わせてカスタマイズしないといけない。
 lessがついている
・用途に応じて選べるようにフォントファイルが分かれている
 (レギュラー・ハーフ・ソーシャル・ファイルタイプ・・・)
・基本的なフォントセットは無料で使えるが、
 数が限られるので使うなら有料版を買っておいたほうがいい。
 一度買っておけば、未来永劫に渡り追加フォントのダウンロードがタダでできるらしい。
・バイナリをダウンロードできるので自分でカスタムアイコンが作れる(.ai, .psd)
##### repo ファイルを作成
vi /etc/yum.repos.d/10gen.repo
## 以下を記述
## 64bitOSの場合
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1
@kurap
kurap / AWS S3 bucket policy
Created November 13, 2013 04:04
備忘:AWS S3 bucket policy
### bucket policy
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "PublicReadForGetBucketObjects",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
CentOS 5.8
ある程度Linux環境に慣れている人を想定していますので、
コマンドベースの説明中心です。
##### Python のインストール
## yum でmakeに必要なツール類をインストールしておく
yum -y groupinstall 'Development Tools'
yum -y install openssl-devel* ncurses-devel* zlib*.x86_64
yum -y install bzip2 bzip2-devel bzip2-libs
#==============================================================================
##
## ntp setup (Ubuntu)
##
#==============================================================================
##### install for ntp
apt-get install ntp
##### disallow UTC
vi /etc/default/rcS