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
import requests | |
from bs4 import BeautifulSoup | |
def main(): | |
res = requests.get("http://b.hatena.ne.jp/hotentry") | |
soup = BeautifulSoup(res.text) | |
for entry in soup.find_all("li", class_="entry-unit"): | |
# 広告を除外 | |
if "ad-unit" not in entry["class"]: |
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
[1,2,3,4,5,6].each do |i| | |
puts "=============" | |
begin | |
puts "i: #{i}" | |
next if i % 3 == 0 | |
raise if i % 2 == 0 | |
rescue => e | |
puts e.inspect | |
else | |
puts "else desu" |
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
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): | |
return 'Hello world!' | |
if __name__ == '__main__': | |
app.run(debug=True, port=5001) |
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 -x | |
for i in 1 2 3 ; do | |
echo $RANDOM | |
done |
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
$ sudo -s | |
# openssl genrsa -des3 2048 > server.key | |
Generating RSA private key, 2048 bit long modulus | |
...............+++ | |
...+++ | |
e is 65537 (0x10001) | |
Enter pass phrase: | |
Verifying - Enter pass phrase: |
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
namespace :db do | |
desc "Run database migrations" | |
task :migrate, :env do |cmd, args| | |
env = args[:env] || "development" | |
Rake::Task['environment'].invoke(env) | |
require 'sequel/extensions/migration' | |
require './model' | |
Sequel::Migrator.apply(DB, "migrate") | |
end |
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
use feature "signatures"; | |
sub hoge ($h, $f) { | |
print "\$h: $h\n"; | |
print "\$f: $f\n"; | |
} | |
hoge("hoge----------!", "fuga----------!"); | |
#=> The signatures feature is experimental at t.pl line 3. |
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
use feature "say"; | |
while (<>) { | |
chomp and s{ +}{:}g; | |
say join ", ", map int, split /:/; | |
} |
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
source "https://rubygems.org" | |
gem "rails", "4.1.4" | |
# Settings | |
gem "rails_config" # https://github.com/railsconfig/rails_config | |
gem "settingslogic" # https://github.com/binarylogic/settingslogic | |
# Databse |
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
source "https://api.berkshelf.com" | |
cookbook "mysql" | |
cookbook 'database' | |
cookbook "ruby_build" | |
cookbook 'rbenv', github: "fnichol/chef-rbenv", ref: "v0.7.2" |
OlderNewer