Skip to content

Instantly share code, notes, and snippets.

View CodeMath's full-sized avatar
🎯
Focusing

codemath CodeMath

🎯
Focusing
  • Seoul, Korea
View GitHub Profile
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
class Counts(models.Model):
user_id = models.ForeignKey(User, on_delete=models.CASCADE)
numbers = models.IntegerField(default=0)
date = models.DateTimeField(auto_created=True, auto_now_add=True)
import datetime
from django.utils.timezone import utc
from rest_framework.authentication import TokenAuthentication
from rest_framework import exceptions
class ExpiringTokenAuthentication(TokenAuthentication):
def authenticate_credentials(self, key):
try:
token = self.model.objects.get(key=key)
/******************************************************************************
* This tutorial is based on the work of Martin Hawksey twitter.com/mhawksey *
* But has been simplified and cleaned up to make it more beginner friendly *
* All credit still goes to Martin and any issues/complaints/questions to me. *
******************************************************************************/
var TO_ADDRESS = "받는 주소"; // change this ...
function doPost(e) {
// 굳이 datas라고 변수로 안해도 됩니다.
@CodeMath
CodeMath / appdelegate.swift
Last active May 24, 2017 04:04
prepare in AppDelegate by Swift 3.0
/***
When get fcm data, set rootviewcontroller that order by Tabbar -> Navaigation -> (Segue) -> view
***/
// AppDelegate.swift
let TabBarViewController : UITabBarController = mainStoryboard.instantiateViewController(withIdentifier: "mainView") as! UITabBarController
// NavigationController
let infoNavigation = mainStoryboard.instantiateViewController(withIdentifier: "infoNavigation") as! UINavigationController
let buystockNavigation = mainStoryboard.instantiateViewController(withIdentifier: "buystockNavigation") as! UINavigationController
@CodeMath
CodeMath / django_settings_and_url_views.py
Created June 9, 2017 05:02
Django Test build about settings,views,urls, etc
"""
Django version 1.9.2
blog
└─── templates
└─── web
└───index.html
└─── web
└───urls.py (새로 추가됨)
└─── blog
@CodeMath
CodeMath / naver_cafe_sellenium.py
Created October 6, 2017 06:25
네이버 카페 글 작성 - 파이썬 셀레늄
#-*- coding: utf-8 -*-
import urllib2
import json
import requests
import ast
import time
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from datetime import datetime
@CodeMath
CodeMath / query.graphql
Last active April 3, 2018 13:46
GitHub - user, repo/count, commit history.
query{
user(login: "CodeMath") {
repositories(last: 100) {
totalCount
nodes {
name
defaultBranchRef {
target {
...on Commit {
history(since: "2018-04-03T00:00:00+00:00") {
@CodeMath
CodeMath / algo.md
Last active April 9, 2018 03:31
백준 랜덤 알고리즘 문제_20180409

20180409 알고리즘 문제 문제출처: https://www.acmicpc.net/problem/14195

문제 The new DotA game is coming out soon. All the fans around the world are waiting to try the new version of DotA: ”DotB”.

There’s a lot of pressure on the developers of the game to add new heroes to it. They come up with ideas but not all of them are worth implementing. For one particular hero they are working on, they asked you to write a program to analyze one of its abilities. The hero’s name is ”Cave Man”, and his ability is to summon a crow to attack a line of enemies.

The line has n enemies with hitpoint h1h2...hn. The crow always starts at the first enemy and attacks each one and goes to the next. It attacks exactly n + 5 times in total, and if it reaches the end of the line, it continues the attack from the other end of the line.

@CodeMath
CodeMath / algo.md
Created April 10, 2018 03:30
백준 랜덤 알고리즘 문제_20180410
@CodeMath
CodeMath / algo.md
Created April 10, 2018 03:31
백준 랜덤 알고리즘 문제_20180410