Skip to content

Instantly share code, notes, and snippets.

View JSpiner's full-sized avatar
:octocat:
loop { eat sleep code }

정성민 JSpiner

:octocat:
loop { eat sleep code }
View GitHub Profile
@JSpiner
JSpiner / slack_oauth_guide.md
Last active November 12, 2023 10:40
Slack OAuth 인증방법
import requests
import sys
SLACK_API_SERVER = "https://slack.com/api/"
class SlackApi:
def __init__(self, token):
self.token = token
@JSpiner
JSpiner / show-git-branch-in-bash-prompt
Last active October 10, 2016 18:31 — forked from stuarteberg/show-git-branch-in-bash-prompt
Code for your .bashrc file. Show current git branch on bash shell prompt....with color! (This was copied and modified from similar code you can find out there on the 'tubes.)
# 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"'\]'
<html>
<a href='https://slack.com/oauth/authorize?scope=channels:write+commands+bot+chat:write:bot+users:read+channels:read&client_id="+key['slackapp']['client_id']+"'><img alt='Add to Slack'
height='40' width='139' src='https://platform.slack-edge.com/img/add_to_slack.png'
srcset='https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/add_to_slack@2x.png 2x' /></a>
</html>
#client_id 는 공개가 되도 문제가없습니다.
@JSpiner
JSpiner / multi lang support test.md
Created October 28, 2016 12:16
multi lang support test.md

1번방법

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
# 해당하는 팀과의 소켓을 연결함
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);
@JSpiner
JSpiner / dfdf.md
Created January 7, 2017 05:20
flow test
st=>start: Start
e=>end
op=>operation: My Operation
cond=>condition: Yes or No?

st->op->cond
cond(yes)->e
cond(no)-&gt;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):
@JSpiner
JSpiner / mysqldump.sh
Created April 18, 2017 07:22
db backup script
#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"