Skip to content

Instantly share code, notes, and snippets.

View fukata's full-sized avatar

fukata fukata

View GitHub Profile
@rkumar
rkumar / gist:445735
Created June 20, 2010 10:47
ruby's OptionParser to get subcommands
#!/usr/bin/env ruby -w
## Using ruby's standard OptionParser to get subcommand's in command line arguments
## Note you cannot do: opt.rb help command
## other options are commander, main, GLI, trollop...
# run it as
# ruby opt.rb --help
# ruby opt.rb foo --help
# ruby opt.rb foo -q
# etc
@fukata
fukata / MY_Loader.php
Created June 24, 2011 01:57
Default escape display vars.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Loader extends CI_Loader {
public function __construct() {
parent::__construct();
}
/**
* CI_Loader::_ci_load is private method.
*
* (non-PHPdoc)
@drcongo
drcongo / fab deploy_static
Last active May 15, 2018 23:28
A Fabric task to deploy static assets to S3, gzipping the js and css files, and invalidating cache objects on CloudFront. Feel free to point out where it could be improved.
import datetime
import arrow
from fabric.api import *
import boto
from boto.cloudfront import CloudFrontConnection
import os
from datetime import date, timedelta
import gzip
import shutil
-- landing page access ranking analysis using Treasure Data
SELECT first_path, COUNT(1) AS count
FROM (
SELECT TD_SESSIONIZE(time, 3600, host) AS session_id, TD_FIRST(path, time) AS first_path
FROM (
SELECT time, v['host'] as host, v['path'] as path
FROM www_access
DISTRIBUTE BY v['host']
SORT BY v['host'], v['time']
) ss
@fukata
fukata / Makefile
Last active December 24, 2015 06:59
ALL go tests.
# see http://d.hatena.ne.jp/holidays-l/20110823/p1
define MAKETEST
for pkg in $$(for f in $$(find ./adstir -name *_test.go); do echo $${f%/*}; done |sort -u)
do
gom test $$pkg
done
endef
export MAKETEST
test:
@echo "$${MAKETEST}" > /tmp/$$$$ ; $(SHELL) /tmp/$$$$ ; rm -f /tmp/$$$$
@ishitcno1
ishitcno1 / MultipartRequest.java
Last active April 7, 2019 18:05
volley multipart request, post file image, android.
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyLog;
import org.apache.http.HttpEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
@FreddyPoly
FreddyPoly / terminal
Last active April 9, 2021 20:38
[REACT NATIVE] Get SHA1
Debug SHA1 (root of project)
keytool -J-Duser.language=en -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Release SHA1 (/android/app/)
keytool -J-Duser.language=en -list -v -keystore mystore.keystore
@shunirr
shunirr / criminal_jc.md
Last active February 26, 2024 05:51
女子中学生チケット詐欺事件

criminal_jc