Skip to content

Instantly share code, notes, and snippets.

View naoaki011's full-sized avatar

naoaki onozaki naoaki011

  • Alfasado Inc.
  • Souka Saitama,Japan
View GitHub Profile
@tokiwatch
tokiwatch / fix_doubleencode.sh
Last active August 29, 2015 14:08
Fix double encoded database.
### このシェルスクリプトは、Latin1のテーブルにUTF8でコンテンツが書き込まれてしまったデータベースを修復します。
my_db='dbname';
my_user='dbuser';
my_pw='dbpassword';
for my_table in $(mysql -u$my_user -p$my_pw -N -s -r $my_db -e 'show tables;'); do
for my_column in $(mysql -u$my_user -p$my_pw -N -r -s -e "use $my_db; show columns from $my_table" | cut -f1); do
echo $my_column;
mysql -u$my_user -p$my_pw -N -r -s -e "use $my_db; UPDATE $my_table SET $my_column = CONVERT(CAST(CONVERT($my_column USING latin1) AS BINARY) USING utf8);"
@terapyon
terapyon / sample.v4.vcl
Last active March 13, 2019 13:51
This file is a sample VCL for Varnish 4.0. It will be used a back-end Plone. And support purge.
#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and http://varnish-cache.org/trac/wiki/VCLExamples for more examples.
@alfasado
alfasado / mt-tools-template.pl
Created November 29, 2012 09:26
Template for MT::Tool::Foo
#!/usr/bin/perl
package MT::Tool::Foo;
use strict;
use warnings;
use File::Spec;
use FindBin;
use lib map File::Spec->catdir( $FindBin::Bin, File::Spec->updir, $_ ), qw/lib extlib/;
use base qw( MT::Tool );
sub usage { '--debug 1' }
@hail2u
hail2u / nu-validator.pl
Created June 12, 2012 20:30
HTML syntax checker with Nu Validator
#!/usr/bin/env perl
use strict;
use warnings;
use JSON;
use LWP::UserAgent;
my $file = shift;
@hail2u
hail2u / uglifyjs.pl
Created April 12, 2012 16:26
UglifyJSのHTTP APIを叩くPerlスクリプト
#!/usr/bin/env perl
# uglifyjs.pl - Compile your JavaScript code with UglifyJS HTTP API
# Usage: uglifyjs.pl < <original file> > <compiled file>
# License: http://hail2u.mit-license.org/2012
# Modified: 2012-04-13T05:20:28+09:00
use strict;
use warnings;
@takimo
takimo / nobita.txt
Created November 23, 2011 04:09
のび太「ドラえもんとか、実際無理だろ」
学生「どうかしました?野比先生」
のび太「ううん、何でもないよ。それより研磨は終わったかい?」
学生「はい。これでもうバリはないはずです」
のび太「本体側のインターロック回路も大丈夫?」
学生「はい、動作確認済みです」
@hail2u
hail2u / hatena-bookmark-count.js
Created October 31, 2011 07:30
a[rel="bookmark"]探してはてブのカウントをくっつける
/*!
* hatena-bookmark-count.js
*
* Copyright (c) 2011 Kyo Nagashima <kyo@hail2u.net>
* This library licensed under MIT license:
* http://opensource.org/licenses/mit-license.php
*/
/*global jQuery, $ */
@coolniikou
coolniikou / markdown-cheat-sheet.jax
Created June 25, 2011 22:35 — forked from hail2u/markdown-cheat-sheet.jax
Markdown カンニングペーパー
*markdown-cheat-sheet.jax* Markdown カンニングペーパー
作者: Kyo Nagashima <kyo@hail2u.net>
バージョン: 0.04
説明: Markdown 記法のカンニングペーパーです。
1. 記法の例 |markdown-cheat-sheet-examples|
1.1 段落 |markdown-cheat-sheet-paragraph|
1.2 改行 |markdown-cheat-sheet-linebreak|
1.3 テキストの強調 |markdown-cheat-sheet-emphasis|
@aklaswad
aklaswad / gist:844870
Created February 26, 2011 02:28
search with meta column
#!/usr/bin/perl
use strict;
use warnings;
use lib qw( lib extlib );
use MT;
MT->new;
use Data::ObjectDriver;
$Data::ObjectDriver::DEBUG = 1;
MT->model('blog')->load(