Skip to content

Instantly share code, notes, and snippets.

View maimai-swap's full-sized avatar

S. Ishimaru maimai-swap

  • individual
  • Japan
View GitHub Profile
@maimai-swap
maimai-swap / lithium_params_request.txt
Created July 20, 2012 01:22
lithium Envronment $params['request']
object(lithium\action\Request)#27 (29) {
["url"]=>
string(33) "conversions/download/adid/from/to"
["params"]=>
array(0) {
}
["persist"]=>
array(0) {
}
["data"]=>
@maimai-swap
maimai-swap / fuse_dfs_mount.sh
Created November 19, 2012 01:27
hdfs を fuseするときのスクリプト
export HADOOP_PREFIX=/root/modules/hadoop-common
export OS_ARCH=amd64
export JAVA_HOME=/etc/alternatives/java_sdk
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/$OS_ARCH/server:/usr/local/lib
export CLASSPATH=`find $HADOOP_PREFIX -name '*.jar' | grep -v 'test' | grep -v 'example' | perl -e '@jars=<STDIN>;chomp @jars; print join(":",@jars);'`
fuse_dfs -odebug -oserver=localhost -oport=9000 /mnt/hdfs
@maimai-swap
maimai-swap / upsidedown.rb
Last active December 10, 2015 19:28
Upside down tweet / earthquake plugin
# -*- coding: utf-8 -*-
# Upside down tweet / earthquake plugin
#
# upd:
#
require 'pp'
class Upd
@@values = {
'a'=>'ɐ','b'=>'q','c'=>'ɔ','d'=>'p','e'=>'ǝ','f'=>'ɟ','g'=>'ƃ','h'=>'ɥ','i'=>'ı',
'j'=>'ɾ','k'=>'ʞ','l'=>'l','m'=>'ɯ','n'=>'u','o'=>'o','p'=>'d','q'=>'b','r'=>'ɹ',
@maimai-swap
maimai-swap / hbase-thrift-test.php
Created April 19, 2013 09:06
hbase-0.92.2にphp経由でアクセスするスクリプト
<?php
$GLOBALS['THRIFT_ROOT'] = 'src/';
include 'gen-php/Hbase/Hbase_types.php';
include 'gen-php/Hbase/Hbase.php';
include 'src/transport/TSocket.php';
include 'src/transport/TBufferedTransport.php';
include 'src/protocol/TBinaryProtocol.php';
@maimai-swap
maimai-swap / query.php
Last active December 16, 2015 12:08
monetdb php sample
<?php
/**
* Connect to a database and perform a query.
*/
error_reporting(E_ALL);
require '/usr/local/share/php/monetdb/php_monetdb.php';
define("DB", "maxroach");
/* Establish a connection and report errors in case they occour */
@maimai-swap
maimai-swap / router.php
Created June 16, 2013 10:06
li3_serverの変更。いつも忘れるので。
<?php
// app/libraries/li3_server/config/router.php
// app/libraries/li3_server においたとき…
$webroot = dirname(dirname(dirname(__DIR__))).'/webroot/';
if (file_exists($webroot . $_SERVER['REQUEST_URI'])) {
return false;
} else {
include_once $webroot.'/index.php';
}
@maimai-swap
maimai-swap / config.rb
Created July 2, 2013 03:51
aws s3 file upload upload_file.rb の XXXXXX に自分のバケット名を入れる。config.yml に access_key_id:secret_access_key: を入れる。これは、https://console.aws.amazon.com/iam/home?#usersから取得できるはず。 ruby upload_file.rb /Users/maimai-swap/tmp/userdic.csv ってやったら bucket 直下に userdic.csvのファイルがアップロードされる。
# Copyright 2011-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
@maimai-swap
maimai-swap / aws-ec2-sample.php
Last active November 4, 2016 19:30
aws sdk php2, ec2 describe and start and stop.
<?php
/**
* Created by JetBrains PhpStorm.
* User: ishimaru
* Date: 2013/07/05
* Time: 17:31
* To change this template use File | Settings | File Templates.
*/
require 'vendor/autoload.php';
@maimai-swap
maimai-swap / getjobfile.sh
Last active December 23, 2015 14:39
リモートのディレクトリで番号が新しくて無い奴をローカルにつくってファイルを持ってくる。
#!/bin/sh
LOCAL_JOB_HOME=/home/myname/downloader
REMOTE_JOB_HOME=/data/downloader/job
ls -1 $LOCAL_JOB_HOME/wait | sort -n > $LOCAL_JOB_HOME/wait_local
ssh myname@remotehost ls $REMOTE_JOB_HOME/wait | sort -n > $LOCAL_JOB_HOME/wait_remote
remote=`comm -3 $LOCAL_JOB_HOME/wait_remote $LOCAL_JOB_HOME/wait_local | awk -F"\t" '{print $1}' | grep "[0-9]"`
@maimai-swap
maimai-swap / snipet.php
Created January 25, 2014 09:20
Wordpress / show Another RSS feed / from http://mypacecreator.net/blog/archives/2021
<?php
// from http://mypacecreator.net/blog/archives/2021
//以下3行の項目を任意に変更
$display_posts_count = 10; //実際に表示したい記事件数
$get_posts_count = 20; //取得する記事件数(PR記事を含むので$display_posts_countより少し多めに設定)
$feed = fetch_feed('http://rssblog.ameba.jp/conboy/rss20.xml'); //取得したいRSS
//以下は必要なければ変更しなくてOK
$counter = 0; //ループ回数カウンター
include_once(ABSPATH . WPINC . '/feed.php');