Skip to content

Instantly share code, notes, and snippets.

View 7kaji's full-sized avatar
🍩
ドンドンドーナツどーんと行こう!

Nakajima 7kaji

🍩
ドンドンドーナツどーんと行こう!
View GitHub Profile
@7kaji
7kaji / sample.php
Created April 20, 2014 13:13
Sample code.
<?php
class Triangle {
public function __construct($width, $height){
$this->width = $width;
$this->height = $height;
}
public function get_width(){return $this -> width;}
public function get_height(){return $this -> height;}
# require 'bundler/setup'
require 'sinatra'
require 'sinatra/base'
require 'sinatra/reloader'
require 'twilio-ruby'
class Message < Sinatra::Base
get '/week' do
content_type 'text/xml'
Twilio::TwiML::Response.new do |r|
history | awk '{print $2}'| sort | uniq -c | sort -nr | head -20
cat ~/.zsh_history | nkf -u | ruby -lane 'time, cmd = $_.scan(/^: (\d+):\d;(.+)$/)[0]; puts cmd.split(/\s/)[0] if time.to_i > Time.now.to_i-60*60*24' | sort | uniq -c | sort -nr | head
cat ~/.zsh_history | nkf -u | ruby -lane 'time, cmd = $_.scan(/^: (\d+):\d;(.+)$/)[0]; puts cmd.split(/\s/)[0] if time.to_i > Time.now.to_i-60*60*24' | sort | uniq -c | sort -nr | tail
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
<?php
define('base_url', 'http://bijint.com/iwate/tokei_images/');
date_default_timezone_set('Asia/Tokyo');
function get_iwate_tokei_image_url() {
$image_url = base_url . date('Hi') . ".jpg";
return $image_url . "\n" . "![iwate_bijintokei]($image_url)";
}
<?php
function main() {
$args = func_get_args();
return call_user_func_array('choice', $args) . "\n";
}
function choice() {
$args = func_get_args();
if(count($args) == 0) {
https://pbs.twimg.com/media/BspTawrCEAAwQnP.jpg
https://pbs.twimg.com/media/BspTkipCIAE4a0n.jpg
https://pbs.twimg.com/media/BspWSkvCAAAMi43.jpg
https://pbs.twimg.com/media/BspWVoqCEAADtZ4.jpg
https://pbs.twimg.com/media/BspWaPYCAAAI6Ui.jpg
https://pbs.twimg.com/media/BswuTdaCQAAQCkg.jpg
https://pbs.twimg.com/media/BspWc7LCAAAPzhS.jpg
https://pbs.twimg.com/media/BspWfqoCYAE836J.jpg
https://pbs.twimg.com/media/BtcSLNRCMAAFGoH.jpg
https://pbs.twimg.com/media/BtcSIHmCUAA8Prp.jpg
require 'ruby-progressbar'
image_file_size = File.size(image_file_size)
if File.size(image_url) > 0
progress_bar = ProgressBar.create(:title => "Uploading...",
:starting_at => 0,
:total => image_file_size,
:output => $stderr,
:format => '%a |%b>>%i| %p%% %t'
)
{"1398524400":197,"1398610800":346,"1398697200":125,"1398783600":234,"1398870000":313,"1398956400":464,"1399042800":235,"1399129200":null,"1399215600":52,"1399302000":118,"1399388400":326,"1399474800":337,"1399561200":975,"1399647600":3,"1399734000":395,"1399820400":318,"1399906800":303,"1399993200":351,"1400079600":325,"1400166000":361,"1400252400":85,"1400338800":40,"1400425200":338,"1400511600":295,"1400598000":252,"1400684400":188,"1400770800":258,"1400857200":701,"1400943600":4,"1401030000":206,"1401116400":319,"1401202800":186,"1401289200":431,"1401375600":424,"1401462000":432,"1401548400":270,"1401634800":307,"1401721200":333,"1401807600":226,"1401894000":462,"1401980400":316,"1402066800":5,"1402153200":52,"1402239600":351,"1402326000":310,"1402412400":296,"1402498800":306,"1402585200":342,"1402671600":317,"1402758000":4,"1402844400":562,"1402930800":327,"1403017200":296,"1403103600":378,"1403190000":282,"1403276400":379,"1403362800":1,"1403449200":424,"1403535600":334,"1403622000":317,"1403708400":311
{"1398524400":4411,"1398610800":7232,"1398697200":3405,"1398783600":5251,"1398870000":7479,"1398956400":10680,"1399042800":5520,"1399129200":null,"1399215600":1195,"1399302000":3336,"1399388400":7837,"1399474800":7338,"1399561200":10190,"1399647600":91,"1399734000":8939,"1399820400":7047,"1399906800":6795,"1399993200":7740,"1400079600":6459,"1400166000":7991,"1400252400":2058,"1400338800":1037,"1400425200":6923,"1400511600":5020,"1400598000":5676,"1400684400":4126,"1400770800":5573,"1400857200":15944,"1400943600":131,"1401030000":4892,"1401116400":6260,"1401202800":4560,"1401289200":9509,"1401375600":9423,"1401462000":10395,"1401548400":7045,"1401634800":6662,"1401721200":6669,"1401807600":5531,"1401894000":10155,"1401980400":7111,"1402066800":171,"1402153200":1403,"1402239600":7411,"1402326000":6619,"1402412400":6943,"1402498800":6318,"1402585200":8202,"1402671600":9094,"1402758000":136,"1402844400":12617,"1402930800":6663,"1403017200":6375,"1403103600":8361,"1403190000":6218,"1403276400":7930,"1403362800":3