Skip to content

Instantly share code, notes, and snippets.

View shuson's full-sized avatar
🎯
Focusing

Nevermoi shuson

🎯
Focusing
View GitHub Profile
@shuson
shuson / copy.md
Created March 18, 2014 09:59 — forked from tiye/copy.md

和大家分享一下我整理的有趣的Github repository,项目地址在repo_starred

欢迎大家fork或者给我发issue

部分内容如下,不定期更新:

GitHub Starred Projects

##navigation

@shuson
shuson / app.py
Last active January 4, 2016 19:08
make flask and nginx allow cross domain ajax requests from angularjs
from flask import Flask
from flask import jsonify
from crossdomain import *
app = Flask(__name__)
@app.route("/user")
@crossdomain(origin='*')
def getuser():
return jsonify({'name': "aaa", "age": 11})
@shuson
shuson / coprime_checker.py
Created July 21, 2013 13:28
By reading RSA algorithm,to generate a series co-prime relation numbers is the basic task. So comes out of this basic method
#if the return is 1, the a b are in coprime relation
#else return the smallest common divisor
def checker(a,b):
while True:
c = a%b
if c == 0:
return b
a = b
b = c
@shuson
shuson / Drupal7 Installation
Last active December 20, 2015 01:19
Drupal7 Installation (Ubuntu12.04) from the very beginning.
Step 1: LAMP installation guide
take a tour to this link http://www.howtoforge.com/ubuntu_lamp_for_newbies
(Don't forget to Include /etc/phpmyadmin/apache.conf to the apache2.conf file)
after those, apache2,php5,mysql and phpmyadmin are done. Type in localhost/phpmyadmin to check whether everything is ok.
Step 2: Download Drupal7 and Extract it to /home/xxx/www and Create new site in apache2
in 'terminal'
cd /etc/apache2/sites-available
sudo cp default drupal7
sudo nano drupal7 #here change DocumentRoot /var/www to /home/xxx/www # I download drupal and extract to /home/xxx/www
#change <Directory /var/www to /home/xxx/www and save
@shuson
shuson / andor.py
Created June 25, 2013 09:56
For those who are familiar with "? :" in C, but "and or" usage in python is a little different.
a = 'a'
b = 'b'
print True and a or b
# output is 'a'
c = '' #bool(c) is False
d = 'd'
print True and c or d
#output is 'd'