Skip to content

Instantly share code, notes, and snippets.

View lu911's full-sized avatar
🎯
Focusing

Seungchan Yuk lu911

🎯
Focusing
View GitHub Profile
#-*- coding:utf8 -*-
import requests
def run():
url = 'http://deview.kr/2014/saveParticipant'
headers = {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Referer': 'http://deview.kr/2014/registParticipant',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 \
def init_log(app):
import os
if not os.path.exists('logs'):
os.makedirs('logs')
import logging
logging.basicConfig(filename='logs/db.log')
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
package com.example.androidta_refort;
public class MainActivity extends Activity {
RadioGroup rg;
ImageView iv;@
Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final TextView rtv = (TextView) findViewById(R.id.dtv);
final TextView rtv2 = (TextView) findViewById(R.id.dtv2);
@lu911
lu911 / logger.js
Created November 12, 2014 06:57
logger.js
app.factory('Logger', function(localStorageService) {
var getUUID = function() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
};
var createTouchEvent = function(el, x, y) {
@lu911
lu911 / mixins.py
Created December 13, 2014 17:52
SQLAlchemy Mixins
# -*- coding:utf-8 -*-
from flask import abort
from datetime import datetime
from project.ext import db
class IdMixin(object):
"""
Provides the :attr:`id` primary key column
@lu911
lu911 / image_of_wand_load_from_url.py
Last active August 29, 2015 14:16
Wand Image object from image url
import urllib, cStringIO
from wand.image import Image
url = 'http://img3.wikia.nocookie.net/__cb20100520131746/logopedia/images/5/5c/Google_logo.png'
f = cStringIO.StringIO(urllib.urlopen(url).read())
i = Image(file=f)
>>> <wand.image.Image: 74d025d 'PNG' (3548x1243)>
@lu911
lu911 / mixin.py
Created April 29, 2015 03:30
serializerMixin
class SerializerMixin(object):
"""
Mixin class for models.
Model define::
class User(SerializerMixin):
id = None
name = None
fields = ('id', 'name')
def __init__(self, _id, name):
self.id = _id
@lu911
lu911 / database.py
Created October 6, 2015 11:18
database.py
# -*- coding:utf-8 -*-
class LoupQuery(Query):
pass
db_session = scoped_session(
sessionmaker(
autocommit=False,
autoflush=False,
@lu911
lu911 / fabric-elbas.py
Created February 15, 2016 03:08
Fabric Deploy Flask AutoScaling
import boto3
import time
timestamp = int(time.time())
session = boto3.Session(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
region_name=region_name
)
@lu911
lu911 / gist:40b8e93315d15204a8f9b96800d7f451
Created November 14, 2016 08:08
Jenkins-Github get AccessToken
println(Jenkins.getAuthentication().getAccessToken());