Skip to content

Instantly share code, notes, and snippets.

Avatar

fukata fukata

View GitHub Profile
@fukata
fukata / fluentd.conf
Created Mar 13, 2014
norikra + fluentd + mongodb
View fluentd.conf
<source>
type forward
</source>
<match data.**>
type copy
<store>
type norikra
norikra 127.0.0.1:26571
@fukata
fukata / client-hoge.ovpn
Last active Aug 29, 2015
OpenVPN client config for iOS 8.1.2
View client-hoge.ovpn
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 Feb 14, 2015
wp-flickr-press post thumbnail usage
View content.php
<?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 Aug 29, 2015
ansible playbook for fukata.org
View playbook.yml
#
# 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 Aug 29, 2015
Travel to Taiwan and Hongkong
View 10-taiwan-2015.08.08-2015.08.10.md

Taiwan 2015.08.08 to 2015.08.10


Day 1

Sit fun(喫飯食堂)

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

View backup.sh
#!/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 Mar 19, 2011
"CodeIgniter2" on "Cache Driver" feature "CodeIgniter1" backported patches. Override system directories.
View CodeIgniter1 cache driver patch
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 Mar 19, 2011
"CodeIgniter2" on "Cache Driver" feature "CodeIgniter1" backported patches. Extends Loader.
View CodeIgniter1 cache driver patch subclass
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 Mar 26, 2011
Twitter has been used in such a function to generate a pretty date format string.
View pretty_date.php
<?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 Mar 27, 2011
PHP variables to be empty string or NULL in making a determination.
View test_blank.php
<?php
// bad example
$v = '0';
if ( empty($v) ) {
echo '$v is blank.';
}
// good example
$v = '0';
if ( strlen($v)==0 ) {