Skip to content

Instantly share code, notes, and snippets.

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"]:
[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"
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello world!'
if __name__ == '__main__':
app.run(debug=True, port=5001)
#!/bin/bash -x
for i in 1 2 3 ; do
echo $RANDOM
done
$ 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:
@rightgo09
rightgo09 / Rakefile
Last active August 29, 2015 14:00
Sequel
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
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.
use feature "say";
while (<>) {
chomp and s{ +}{:}g;
say join ", ", map int, split /:/;
}
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
@rightgo09
rightgo09 / Berksfile
Last active August 29, 2015 14:05
Vagrantfile
source "https://api.berkshelf.com"
cookbook "mysql"
cookbook 'database'
cookbook "ruby_build"
cookbook 'rbenv', github: "fnichol/chef-rbenv", ref: "v0.7.2"