Skip to content

Instantly share code, notes, and snippets.

@cnsoft
cnsoft / gist:5931455
Created July 5, 2013 03:29
Twitter oauth flow
I'm not familiar with this library, can you explain a bit more about how it interacts with OAuth? You're using some words here that don't really jive with OAuth: a token or key should never be present in any kind of "div" or "box" -- what's the usual sequence of events here? Are you doing some kind of page scraping?
If you're using callback-based OAuth, the sequence should be:
a) You ask for a request token
b) You send the user for authorization
c) They get sent to the oauth_callback you specified in step a
d) You exchange the request token for an access token using the oauth_verifier you got in step c
If you're using out-of-band based OAuth, the sequence should be:
/*
Example program to demonstrate sharing public keys from CryptoApi to CNG
Note: Reversing the process would allow sharing public keys from CNG to
CryptoApi. You would need to be careful of padding parameters and
versions.
License (yes, yes, BSD):
Copyright (c) 2013, Marc Durdin
import os
import sys
sys.path += [os.path.join(
os.path.dirname(
os.path.abspath(__file__)), 'lib')]
# Pythonista Modules
import console
from scene import *
import urllib2, urlparse, sys, webbrowser
itags = {'45': 'webm_720p',
'44': 'webm_480p',
'43': 'webm_360p',
'38': 'mp4_3072p',
'37': 'mp4_1080p',
'36': 'phone_mp4_240p',
'35': 'flv_480p',
'34': 'flv_360p',
@cnsoft
cnsoft / convertW2U.py
Created August 1, 2013 02:37
This script is used to convert win style CTRL+LF to Unix style. to avoid svn conflict .
import os
filters = ['.cpp','.h','.py','.hpp','.ipp','.sln','.vcproj','.mak']
filters.extend(['.c','python','Makefile','php'])
#filters = ['python']
#filters = ['*']
if os.name == 'posix':
FOLDER_FIX = '/'
else:
FOLDER_FIX = "\\"
@cnsoft
cnsoft / Apple Review GuideLines.html
Created August 3, 2013 14:02
Apple Review GuideLines
Introduction
We're pleased that you want to invest your talents and time to develop applications for iOS. It has been a rewarding experience - both professionally and financially - for hundreds of thousands of developers and we want to help you join this successful group. We have published our App Store Review Guidelines in the hope that they will help you steer clear of issues as you develop your App and speed you through the approval process when you submit it.
We view Apps different than books or songs, which we do not curate. If you want to criticize a religion, write a book. If you want to describe sex, write a book or a song, or create a medical App. It can get complicated, but we have decided to not allow certain kinds of content in the App Store. It may help to keep some of our broader themes in mind:
We have lots of kids downloading lots of Apps, and parental controls don't work unless the parents set them up (many don't). So know that we're keeping an eye out for the kids.
We have over 700,000 A
@cnsoft
cnsoft / Firefly
Last active December 20, 2015 20:59
Firefly是免费、开源、稳定、快速扩展、能 “热更新”的分布式游戏服务器端框架,采用Python编写,基于Twisted框架开发。它包括了开发框架和数据库缓存服务等各种游戏服务器基础服务,节省大量游戏开发的工作时间,真正做到让使用者把精力放在游戏玩法逻辑上。用它可以搭建自定义的分布式架构,只需要修改相应的配置文件即可。
优势特性
采用单线程多进程架构,支持自定义的分布式架构;
方便的服务器扩展机制,可快速扩展服务器类型和数量;
与客户端采用TCP长连接,无需考虑粘包等问题;
封装数据缓存服务;
可实现实时热更新数据以及游戏逻辑,客户端玩家无感觉;
有几十个基础游戏玩法系统模块提供组装使用(v1.3.0提供);
1.CentOS 6.3
#yum install make gcc
#cd /opt
$wget http://redis.googlecode.com/files/redis-2.x.xx.tar.gz
$tar zxf redis-2.x.xx.tar.gz
$cd redis-2.x.xx
$make
$make install
//////
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
@cnsoft
cnsoft / xingqiba.py
Created August 27, 2013 07:20
weiyouxi.api python
http://xingqibawiki.sinaapp.com/index.php/Python-category#test
#test
import web
import api
urls = (
'/', 'index'
)
class index: