Skip to content

Instantly share code, notes, and snippets.

View fukata's full-sized avatar

fukata fukata

View GitHub Profile
@fukata
fukata / fluentd.conf
Created March 13, 2014 05:26
norikra + fluentd + mongodb
<source>
type forward
</source>
<match data.**>
type copy
<store>
type norikra
norikra 127.0.0.1:26571
@fukata
fukata / client-hoge.ovpn
Last active August 29, 2015 14:14
OpenVPN client config for iOS 8.1.2
tls-client
key-direction 1
remote YOURSERVER
comp-lzo
cipher BF-CBC
port 1194
proto udp
redirect-gateway def1
<ca>
-----BEGIN CERTIFICATE-----
@fukata
fukata / content.php
Created February 14, 2015 09:45
wp-flickr-press post thumbnail usage
<?php // デフォルトサイズのサムネイル表示 ?>
<?php FlickrPress::isExtractThumbnailByPostID( get_the_ID() ) ? the_post_thumbnail() : the_post_thumbnail('thumbnail') ?>
<?php // サイズ指定でサムネイル表示 ?>
<?php FlickrPress::isExtractThumbnailByPostID( get_the_ID() ) ? the_post_thumbnail('q') : the_post_thumbnail('thumbnail') ?>
@fukata
fukata / playbook.yml
Last active August 29, 2015 14:22
ansible playbook for fukata.org
#
# fukata.org
# ansible v1.8.2
#
- hosts: all
sudo: yes
vars:
swap_count: 1024
nginx_version: 1.9.1
ngx_cache_purge_version: 2.3
@fukata
fukata / 10-taiwan-2015.08.08-2015.08.10.md
Last active August 29, 2015 14:25
Travel to Taiwan and Hongkong

Taiwan 2015.08.08 to 2015.08.10


Day 1

Sit fun(喫飯食堂)

No. 5, Lane 8, Yongkang St, Da’an DistrictTaipei City, 台湾 106

#!/bin/bash -x
DT=$(date +"%Y%m%d")
BACKUP_TMP_DIR=/tmp/backups-${DT}
BACKUP_DEST_PREFIX=services/blog.pg-applications.com/${DT}
BACKUP_BUCKET="BUCKET NAME"
BACKUP_NUM=10
DB_NAME="WP DB NAME"
mkdir -p $BACKUP_TMP_DIR
@fukata
fukata / CodeIgniter1 cache driver patch
Created March 19, 2011 22:40
"CodeIgniter2" on "Cache Driver" feature "CodeIgniter1" backported patches. Override system directories.
diff -Nru /home/tatsuya/DOWNLOAD/php/CodeIgniter_1.7.3/system/libraries/Cache/Cache.php ./system/libraries/Cache/Cache.php
--- /home/tatsuya/DOWNLOAD/php/CodeIgniter_1.7.3/system/libraries/Cache/Cache.php 1970-01-01 08:00:00.000000000 +0800
+++ ./system/libraries/Cache/Cache.php 2011-03-20 06:22:57.267999183 +0800
@@ -0,0 +1,216 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
@fukata
fukata / CodeIgniter1 cache driver patch subclass
Created March 19, 2011 23:32
"CodeIgniter2" on "Cache Driver" feature "CodeIgniter1" backported patches. Extends Loader.
diff -Nru /home/tatsuya/DOWNLOAD/php/CodeIgniter_1.7.3/system/application/libraries/Cache/Cache.php ./system/application/libraries/Cache/Cache.php
--- /home/tatsuya/DOWNLOAD/php/CodeIgniter_1.7.3/system/application/libraries/Cache/Cache.php 1970-01-01 08:00:00.000000000 +0800
+++ ./system/application/libraries/Cache/Cache.php 2011-03-20 07:28:52.003705893 +0800
@@ -0,0 +1,216 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
@fukata
fukata / pretty_date.php
Created March 26, 2011 10:43
Twitter has been used in such a function to generate a pretty date format string.
<?php
function pretty_date($time) {
$diff = time() - $time;
$day_diff = floor($diff / 86400);
if(is_nan($day_diff)) return '';
if ($day_diff == 0) {
if ($diff < 60) {
return $diff . "second ago";
@fukata
fukata / test_blank.php
Created March 27, 2011 05:36
PHP variables to be empty string or NULL in making a determination.
<?php
// bad example
$v = '0';
if ( empty($v) ) {
echo '$v is blank.';
}
// good example
$v = '0';
if ( strlen($v)==0 ) {