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
class X(object): | |
we = [] | |
def __init__(self): | |
X.we.append(self) | |
@classmethod | |
def get_we(cls): | |
return [x for x in X.we if x.__class__ is cls] | |
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
package org.myorg; | |
import java.io.IOException; | |
import java.util.*; | |
import java.lang.Math; | |
import org.apache.hadoop.fs.Path; | |
import org.apache.hadoop.conf.*; | |
import org.apache.hadoop.io.*; | |
import org.apache.hadoop.mapred.*; |
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
#!/usr/bin/env python | |
# -*- coding:utf-8 -*- | |
import random | |
N = 20 | |
G = 10 | |
ANS = 15 | |
def evalf(x): |
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
alias emacs='emacs 2> ~/emacs_stderror' |
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
# -*- coding:utf-8 -*- | |
""" | |
re.compile(before).sub(after, source)について | |
beforeとafterが離れていて | |
afterとsourceがくっついているのがいまいちだったので、 | |
自分が好きな形にラップした。 | |
関数バージョンとクラスバージョンを作って速度テストも行った結果、 | |
コンパイルが1回で済むクラスバージョンの方が速い(当然) | |
""" |
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
sig Name{} | |
sig Date{} | |
sig BirthdayBook{ | |
known : set Name, | |
birthday : Name -> one Date | |
}{ | |
known = birthday . Date | |
} | |
pred addBirthday [bb, bb': BirthdayBook, n: Name, d: Date] { |
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
# FirstIdea | |
SELECT ProductID, ProductName, Price FROM Products WHERE ProductType IN (SELECT ProductType FROM Categories WHERE Category = 'Printer') AND (ProductID IN (SELECT ProductID FROM ShopA WHERE Stock >= 5) + (SELECT ProductID FROM ShopB WHERE Stock >= 5)); | |
# Use Join Operation | |
SELECT Products.ProductID, Products.ProductName, Products.Price FROM (((Products INNER JOIN Categories ON Products.ProductType = Categories.ProductType) INNER JOIN ShopA ON Products.ProductID = ShopA.ProductID) INNER JOIN ShopB ON Products.ProductID = ShopB.ProductId) WHERE Categories.Category = 'Printer' AND (ShopA.Stock >= 5 OR ShopB.Stock >= 5); | |
#------------------------------------------------------------------------------- | |
# 店A,Bの両方で在庫がある商品のIDを取得 | |
SELECT * FROM ((SELECT ProductID AS ida FROM ShopA WHERE Stock > 0) INNER JOIN (SELECT ProductID AS idb FROM ShopB WHERE Stock > 0) ON ida = idb); |
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
<QueryList> | |
<Query Id="0" Path="Security"> | |
<Select Path="Security"> | |
(*[System[(EventID=4647)]]) or | |
(*[System[(EventID=4624)]] and | |
*[EventData[Data[@Name='ProcessName']='C:\Windows\System32\winlogon.exe']] and | |
(*[EventData[Data[@Name='TargetUserName']='user1']] or | |
*[EventData[Data[@Name='TargetUserName']='user2']] or | |
*[EventData[Data[@Name='TargetUserName']='user3']]) and |
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
[Procfile] | |
+web: python twhyou/manage.py runserver 0.0.0.0:$PORT --noreload | |
[requirements.txt] | |
+Django==1.4.2 | |
+psycopg2==2.4.5 | |
+tweepy==1.12 | |
+wsgiref==0.1.2 | |
[myproj/myproj/settings.py] |
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
# -*- coding: utf-8 -*- | |
import datetime | |
# 日本時間 | |
class JST(datetime.tzinfo): | |
""" | |
日本時間で作成 | |
japan_time = datetime.datetime.now(jst) |