Skip to content

Instantly share code, notes, and snippets.

View kurap's full-sized avatar

TetsuyaKurata kurap

View GitHub Profile
@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 / 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 / vagrant_command
Last active August 29, 2015 14:08
Vagrant command
## vm 起動
vagrant up
## vm 停止
vagrant halt
## vm 休止
vagrant suspend
## vm 削除
upstream some_app_server {
server 127.0.0.1:9393;
}
server {
listen 80;
server_name my-upload-endpoint.com ;
@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
@kurap
kurap / python class of facebook api access
Last active January 4, 2016 11:09
Download image from Facebook Profile Picture using Django
FACEBOOK_API_PICTURE_URL = "https://graph.facebook.com/#id#/picture/"
class util_fb:
def __init__(self, access_token=None):
self.access_token = access_token
self.user_agent = PROJECT_NAME + '/' + PROJECT_VERSION
self.error_code = 0
self.message = ""
def get_people_picture(self, fb_id, width=200, height=200):
@kurap
kurap / Access-Control-Allow-Origin
Created November 19, 2013 15:11
クロスドメインでWEBフォントを使用する場合の設定
IE, Firefoxの最新版だとクロスドメイン制約のため、S3からWEBフォントをダウンロードしようとするとエラーとなる。
>> 対処方法
bucket の [properties] - [Permissions] の [add cors configuration]に設定を追加
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin> #### ←ここに許可するドメインを追加 *はワイルドカードなので全許可
<AllowedMethod>GET</AllowedMethod>
1.<meta> viewportを除く
2..container クラスのwidth属性を統一して!importantを追加
.container {
max-width: none !important;
width: 970px;
}
3..navbar を使っている場合は、colloapsing 属性を取り除く
@kurap
kurap / css rotate
Last active December 28, 2015 09:39
90度右に回転
.rotate {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
transform: rotate(90deg);
}
#==============================================================================
##
## OPENSSL Nginx (ubuntu)
##
#==============================================================================
####OpenSSL の設定(自己証明書生成)
mkdir /etc/nginx/conf
cd /usr/local/nginx/conf
#CSRの生成