static.py
CODE_LANG_KR = 1
CODE_LNAG_EN = 2
CODE_TEXT_HELLO_WORLD = 1
CODE_TEXT_GOOD_BYE = 2
CODE_TEXT_START_GAME = 3
import requests | |
import sys | |
SLACK_API_SERVER = "https://slack.com/api/" | |
class SlackApi: | |
def __init__(self, token): | |
self.token = token |
# Colors for the prompt | |
blue="\033[0;34m" | |
white="\033[0;37m" | |
green="\033[0;32m" | |
magenta="\033[0;55m" | |
# Brackets needed around non-printable characters in PS1 | |
ps1_blue='\['"$blue"'\]' | |
ps1_green='\['"$green"'\]' | |
ps1_white='\['"$white"'\]' |
# 해당하는 팀과의 소켓을 연결함 | |
def open_socket(teamId, data): | |
redis_manager.redis_client.hset('rtm_status_'+teamId, 'status', SOCKET_STATUS_CONNECTING) | |
redis_manager.redis_client.hset('rtm_status_'+teamId, 'expire_time', time.time() + SOCKET_EXPIRE_TIME) | |
result = db_manager.query( | |
"SELECT team_bot_access_token " | |
"FROM TEAM " |
var http = require('http'); | |
function onRequest(request, response) { | |
console.log('request received.'); | |
response.writeHead(200, {'Content-Type' : 'text/plain'}); | |
response.write('Hello World'); | |
response.end(); | |
} | |
http.createServer(onRequest).listen(8888); |
st=>start: Start
e=>end
op=>operation: My Operation
cond=>condition: Yes or No?
st->op->cond
cond(yes)->e
cond(no)->op
class DictDiffer(object): | |
def __init__(self, past_dict, current_dict): | |
self.current_dict, self.past_dict = current_dict, past_dict | |
self.set_current, self.set_past = set(current_dict.keys()), set(past_dict.keys()) | |
self.intersect = self.set_current.intersection(self.set_past) | |
def added(self): | |
return self.set_current - self.intersect | |
def removed(self): |
#db dump script | |
#ex) mysqldump -uroopt -p1234 db > "dbbackup_$(date '+%Y-%m-%d').sql" | |
#result : dbbackup_2017-04-18.sql | |
mysqldump -uID -pPW DBNAME > "dbbackup_$(date '+%Y-%m-%d').sql" | |
public final class FlingBehavior extends AppBarLayout.Behavior { | |
private boolean isPositive; | |
private float mFlingFriction = ViewConfiguration.getScrollFriction(); | |
private float DECELERATION_RATE = (float) (Math.log(0.78) / Math.log(0.9)); | |
private final float INFLEXION = 0.35f; | |
private float mPhysicalCoeff; |