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 csv | |
import re | |
tels = [] | |
with open('coffee-filtered.csv', 'wb') as outfile: | |
writer = csv.writer(outfile, delimiter=',') | |
with open('coffee.csv', 'rb') as infile: | |
reader = csv.reader(infile, delimiter=',') |
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
Filename: test_profile.py | |
Line # Mem usage Increment Line Contents | |
================================================ | |
4 @profile | |
5 5.938 MB 0.000 MB def test_list(): | |
6 6.469 MB 0.531 MB for x in range(0, 5000): | |
7 6.469 MB 0.000 MB x | |
8 6.469 MB 0.000 MB return 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
from django.contrib.auth.models import User | |
from rest_framework import serializers | |
class UserSerializer(serializers.ModelSerializer): | |
password2 = serializers.CharField() | |
def validate_password2(self, attrs, source): | |
password2 = attrs.pop(source) | |
if attrs['password'] != password2: | |
raise serializers.ValidationError('password mismatch') |
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 django.core.serializers.json import DjangoJSONEncoder | |
from django.db.models.fields.files import FieldFile | |
""" | |
django.core.serializers.json.DjangoJSONEncoder 에는 | |
datetime.datetime, datetime.date, datetime.time, decimal.Decimal | |
에 대한 처리가 되어있음. | |
""" | |
class MyJSONEncoder(DjangoJSONEncoder): |
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 requests | |
from BeautifulSoup import BeautifulSoup, NavigableString | |
def get_string(parent): | |
l = [] | |
for tag in parent: | |
if isinstance(tag, NavigableString): | |
l.append(tag.string) | |
else: |
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 BaseHTTPServer | |
import SimpleHTTPServer | |
class DownloadHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def send_head(self): | |
"""Common code for GET and HEAD commands. |
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
package com.example | |
import android.content.BroadcastReceiver | |
import android.content.Context | |
import android.content.Intent | |
import android.telephony.PhoneStateListener | |
import android.telephony.ServiceState | |
import android.telephony.TelephonyManager | |
import kotlin.properties.Delegates | |
import kotlinLib.* |
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
package com.example | |
import android.app.Activity | |
import android.os.Bundle | |
import android.widget.MediaController | |
import android.widget.VideoView | |
class VideoViewActivity(): Activity() { | |
class object { | |
val TAG = javaClass<VideoViewActivity>().getSimpleName() |
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 random | |
MAP = { | |
('가위', '가위'): 0, | |
('가위', '바위'): -1, | |
('가위', '보'): 1, | |
('바위', '가위'): 1, | |
('바위', '바위'): 0, | |
('바위', '보'): -1, | |
('보', '가위'): -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 | |
def parse(bin): | |
raw_blocks = [] | |
block = [] | |
for line in bin.splitlines(): | |
line = line.strip() | |
if line.startswith('*'): |