This file contains hidden or 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
| <?php | |
| $in = [111, 45, 4534, 4, 2356, 66]; | |
| $ordered = false; | |
| $len = count($in); | |
| while(!$ordered) { | |
| $ordered = true; |
This file contains hidden or 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
| #compile-cacheとstorageはdropboxでsyncしないようにあらかじめ外しておく | |
| for f in ~/Dropbox/atom-sync/*; do ln -s $f ~/.atom/`basename $f`; done |
This file contains hidden or 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
| <Directory /path/to/public_html> | |
| EnableMMAP Off | |
| EnableSendfile Off | |
| </Directory> |
This file contains hidden or 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
| grep '17/Jul/2014' foo.bar.net-access_log | awk '$9==200{print}' | cut -f2,3 -d: | sort | uniq -c | less |
This file contains hidden or 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
| alias ajax="curl --header \"X-Requested-With: XMLHttpRequest\"" |
This file contains hidden or 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
| { | |
| "5" : [9, 23, 31, 37, 44, 51, 58], | |
| "6" : [3, 8, 14, 19, 24, 29, 34, 39, 44, 49, 54, 59], | |
| "7" : [4, 9, 12, 15, 19, 22, 25, 29, 32, 35, 39, 42, 45, 49, 52, 55, 59], | |
| "8" : [2, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 58], | |
| "9" : [2, 7, 12, 16, 20, 24, 28, 32, 37, 42, 47, 52, 56], | |
| "10" : [1, 6, 11, 16, 21, 25, 30, 35, 40, 45, 50, 55, 59], | |
| "11" : [4, 9, 15, 21, 27, 33, 39, 45, 51, 57], | |
| "12" : [3, 9, 15, 21, 27, 33, 39, 45, 51, 57], | |
| "13" : [3, 9, 15, 21, 27, 33, 39, 45, 51, 57], |
This file contains hidden or 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
| apt-get update | |
| apt-get dist-upgrade | |
| apt-get install -y apache2 nginx | |
| # ruby | |
| sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev | |
| cd /tmp | |
| wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | |
| tar -xvzf ruby-2.1.2.tar.gz ruby-2.1.2/ |
This file contains hidden or 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
| # usage | |
| # $ ruby pushover_sample.rb hogehoge | |
| require "net/https" | |
| url = URI.parse("https://api.pushover.net/1/messages") | |
| req = Net::HTTP::Post.new(url.path) | |
| req.set_form_data({ | |
| :token => "YOUR_TOKEN", |
This file contains hidden or 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
| require 'prime' | |
| require 'date' | |
| def primedays(year) | |
| Array(Date.new(year,1,1)..Date.new(year,12,31)).flat_map {|d| | |
| Prime.prime?(d.strftime('%Y%m%d').to_i) ? [d.to_s] : [] | |
| } | |
| end | |
| primedays(2014) |