Skip to content

Instantly share code, notes, and snippets.

View toughrogrammer's full-sized avatar

Juhong Jung toughrogrammer

View GitHub Profile
try:
auth = OAuth(access_token) if use_auth else None
payload_data = json.dumps(payload) if payload is not None else None
if payload_data is None:
request = requests.Request(method, url, params=params, auth=auth).prepare()
else:
request = requests.Request(method, url, params=params, data=payload_data, auth=auth).prepare()
request.headers['Content-Type'] = 'application/json'
@oauth_provider.invalid_response
def invalid_response(req):
if req.error_message == 'Bearer token is expired.':
raise ExpiredError
elif req.error_message == 'Bearer token scope not valid.':
raise NoPermissionError
else:
raise RequiredSignInError
@app.route('/oauth/login', methods=['GET'])
def oauth_login():
form_data = {
'code': request.args['code'],
'redirect_uri': url_for('oauth_login', _external=True),
'grant_type': 'authorization_code',
'client_id': app.config.get('OAUTH_CLIENT_ID'),
'client_secret': app.config.get('OAUTH_CLIENT_SECRET'),
'scope': 'god'
}
def get_oauth_req_url():
params = {
'client_id': app.config.get('OAUTH_CLIENT_ID'),
'response_type': 'code',
'scope': 'god',
'next': urlparse(request.url).path
}
return "{0}/oauth/authorize?{1}".format(app.config.get('OAUTH_SERVER'), urlencode(params))
HCOPY 000000001033
DBUFFER000033BUFEND001033LENGTH00002D
RRDREC WRREC
T0000001D1720274B1000000320232900003320074B1000003F2FEC0320160F2016
T00001D0D0100030F200A4B1000003E2000
T00003003454F46
M00000405+RDREC
M00001105+WRREC
M00002405+WRREC
E000000
#include <stdio.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
#define Random0to1 ((double) rand() / (RAND_MAX)) + 1
#define ITERATION 100000000
package codelab.gdg.watchfacehack;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.support.wearable.watchface.CanvasWatchFaceService;
import android.view.SurfaceHolder;
public class AnalogWatchFaceService extends CanvasWatchFaceService {
@Override
@toughrogrammer
toughrogrammer / helloworld_.idea_.name
Created October 24, 2014 15:54
helloworld for opengl & glut with clion
helloworld
@toughrogrammer
toughrogrammer / CMakeLists.txt
Created October 24, 2014 09:13
cmakelists for opengl, glut on mac(practical)
cmake_minimum_required(VERSION 2.8.4)
project(helloworld)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#########################################################
# Include Files
#########################################################
set(SOURCE_FILES main.cpp Cool.cpp)
add_executable(helloworld ${SOURCE_FILES})
using UnityEngine;
using System.IO;
public class Logger : MonoBehaviour
{
StreamWriter _writer;
public void Prepare()
{
#if UNITY_EDITOR