This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stdlib | |
# lib | |
from django.contrib.admin.filters import ( | |
BooleanFieldListFilter, | |
) | |
# app | |
class BooleanDropdownFilter(BooleanFieldListFilter): | |
template = 'boolean_dropdown_filter.html' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# stdlib | |
import os | |
import glob | |
from contextlib import contextmanager | |
import shutil | |
icon_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'icons') | |
os.makedirs(icon_dir,exist_ok=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: install packages | |
yum: name={{ item }} | |
with_items: | |
- postfix | |
- dovecot | |
- name: aliases.regexp | |
shell: echo "/(?!^root$|^catchall$)^.*$/ catchall" >> /etc/aliases.regexp creates=/etc/aliases.regexp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::uses('Shell', 'Console'); | |
class ColorShell extends Shell { | |
public function main($command = null) { | |
$this->out("<emergency>emergency</emergency>"); | |
$this->out("<alert>alert</alert>"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
from fabric.api import * | |
from fabric.contrib.files import * | |
######################################## | |
# クライアントにnrpeをインストール | |
######################################## | |
def client_setup(): | |
with settings( | |
hide('warnings', 'running'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* twitter 表示 | |
* 1時間60回 | |
* 1分のキャッシュ | |
*/ | |
require_once getenv('DOCUMENT_ROOT').'/../lib/twitteroauth/twitteroauth/twitteroauth.php'; | |
$consumer_key = ''; | |
$consumer_secret = ''; | |
$access_token = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 画像のパスを変える | |
* @param {[type]} $html [description] | |
* @return {[type]} [description] | |
*/ | |
function convert($basedir,$html){ | |
$img_pattern = '/<img .*?src="(.*?)".*?>/i'; | |
$src_pattern = '/src="(.*?)"/'; | |
/*---------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 前後の商品 | |
* | |
*/ | |
public function neighbors($product_id){ | |
$objQuery =& SC_Query_Ex::getSingletonInstance(); | |
//prev | |
$objQuery->setOrder('product_id DESC'); | |
$objQuery->setLimit('1'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
set -e | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/user/bin | |
NAME=nginx | |
DESC="nginx deamon" | |
DAEMON=/usr/sbin/$NAME | |
SCRIPTNAME=/etc/init.d/$NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax on | |
set autoindent | |
set number | |
if has('gui_macvim') | |
set showtabline=2 " タブを常に表示 | |
set imdisable " IMを無効に | |
set antialias " アンチエイリアスを有効に | |
set cindent " Cインデントを利用 | |
set expandtab " タブを空白文字で |
NewerOlder