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/bash | |
VIM=/usr/bin/vim | |
FILE=${1%:*} | |
LINE=${1#*:} | |
if [[ "$LINE" =~ ^[0-9]+$ ]] | |
then | |
$VIM +"$LINE" "$FILE" | |
else |
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
#include <opencv/cv.h> | |
#include <opencv/highgui.h> | |
#include <time.h> | |
// http://opencv.jp/sample/text.html | |
// gcc put_text_sample.c -o put_text_sample `pkg-config --libs --cflags opencv` && ./put_text_sample | |
int | |
main (int argc, char **argv) | |
{ |
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/bash | |
################################################################### | |
# | |
# 当スクリプトでは、以下のことを行う。 | |
# | |
# 1./etc/apache2/site-available, /etc/apache2/site-enabledへの | |
# VirtualHostの設定を記述したファイルを設置 | |
# 2./var/log/apache2に指定したドメインのディレクトリを作成 | |
# 3./etc/hostsに指定したドメインを追加 | |
# |
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
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *dir = [paths objectAtIndex:0]; | |
NSLog(@"dir=%@", dir); | |
NSString *filePath = [dir stringByAppendingPathComponent:@"hoge.flv"]; | |
NSLog(@"filePath=%@", filePath); | |
NSFileManager *fm = [NSFileManager defaultManager]; | |
BOOL exists = [fm fileExistsAtPath:filePath isDirectory:NO]; | |
BOOL writable = [fm isWritableFileAtPath:filePath]; | |
BOOL readable = [fm isReadableFileAtPath:filePath]; |
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
this is test. |
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
; | |
(function(window, $){ | |
var EXPR_RE = new RegExp("^\\s*([a-z][a-z0-9\\-]*)\\s*(=|\\!=|>|<|>=|<=|\\^=|\\*=)\\s*(.+)\\s*$"); | |
$.expr[":"].data = function(elem, index, args) { | |
// validation arguments | |
var expr = args[3]; | |
if (!expr.match(EXPR_RE)) { | |
return false; | |
} |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use Encode; | |
use Text::MeCab; | |
use JSON::XS; | |
use Data::MessagePack; |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use Redis; | |
srand(time ^ ($$ + ($$ << 15))); | |
my $max_rand = 100000000000; | |
my $keybase = 'HOGE::'; |
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
#!/usr/bin/env ruby | |
require 'td' | |
require 'td-client' | |
require 'mongo' | |
WEEK = 604800 | |
cln = TreasureData::Client.new(ENV['TREASURE_DATA_API_KEY']) | |
job = cln.query('agesage', "select v['query'] as keyword, count(*) as cnt from queries where v['query'] != '' and v['time'] > unix_timestamp() - #{WEEK} group by v['query']") | |
until job.finished? |
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
# agesage viewer | |
<source> | |
type tail | |
format /^q\:(?<query>.*), page\:(?<page>[0-9]+), slag\:(?<slag>[^ ]+), time\:(?<time_max>[0-9]*), sort\:(?<sort>[^ ]+), order\:(?<order>[^ ]+)$/ | |
path /var/log/asg/query.log | |
tag agesage.queries | |
pos_file /var/log/td-agent/agesage.queries.pos | |
</source> | |
<match agesage.queries> |