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
syntax on | |
filetype plugin on | |
" filetype | |
let pascal_delphi=1 | |
let pascal_symbol_operator=1 | |
let pascal_no_tabs=1 | |
au BufNewFile,BufRead *.pp,*.rops setf pascal | |
au BufNewFile,BufRead *.htn setf hatena |
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
import os | |
import base64 | |
import time | |
import webbrowser | |
DATA = r""" | |
/9j/4AAQSkZJRgABAQEASABIAAD/4QCARXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUA | |
AAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAA | |
AEgAAAABAAKgAgAEAAAAAQAAAhSgAwAEAAAAAQAAAhQAAAAA/+IFWElDQ19QUk9GSUxFAAEBAAAF |
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
>>> class Counter: | |
... def __init__(self): | |
... self.value = 0 | |
... def __call__(self): | |
... self.value += 1 | |
... return self.value | |
... | |
>>> c = Counter() | |
>>> c() | |
1 |
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
# coding: utf-8 | |
import json | |
class Spam(object): | |
def __init__(self, name, value): | |
self.name = name | |
self.value = value | |
def __repr__(self): | |
return "<%s: name=%s, value=%s>" % ( |
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
# coding: utf-8 | |
import cPickle as pickle | |
class Spam(object): | |
def __init__(self, name, value): | |
self.name = name | |
self.value = value | |
def __repr__(self): | |
return "<%s: name=%s, value=%s>" % ( |
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
from google.appengine.ext import db | |
class User(db.Model): | |
nickname = db.StringProperty() | |
class Comment(db.Model): | |
user = db.ReferenceProperty(User) | |
text = db.StringProperty() | |
def get_commented_user_nicknames_1(): |
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
from google.appengine.ext import db | |
class Foo(db.Model): | |
a_value = db.IntegerProperty() | |
def save_foo_values_1(values): | |
for value in values: | |
obj = Foo(a_value=value) | |
obj.put() |
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
# coding: utf-8 | |
import socket | |
def get_host_name(s): | |
for line in s.splitlines(): | |
if line.startswith('Host:'): | |
return line[6:] | |
def host_to_ip(s): |
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
import socket | |
def get_host_name(s): | |
for line in s.splitlines(): | |
if line.startswith('Host:'): | |
return line[6:] | |
def host_to_ip(s): | |
return socket.getaddrinfo(s, 80)[0][4][0] |
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
ほげは「真」 | |
もし、ほげが「真」ならば | |
「こんちには世界」と表示 |