和大家分享一下我整理的有趣的Github repository,项目地址在repo_starred
欢迎大家fork或者给我发issue
部分内容如下,不定期更新:
##navigation
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' |
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 |
#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 |
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}) |
和大家分享一下我整理的有趣的Github repository,项目地址在repo_starred
欢迎大家fork或者给我发issue
部分内容如下,不定期更新:
##navigation
#!/usr/bin/python | |
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org) | |
# The author disclaims copyright to this source code. | |
import sys | |
import struct | |
import socket | |
import time | |
import select |
I came across this issue using the following code file | |
the error message is ReferenceError: weakly-referenced object no longer exists | |
reason is in the mysql/connector/cursor.py file | |
see these lines: | |
def _set_connection(self, connection): | |
"""Set the connection""" | |
try: |
/* | |
* To change this template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
import java.io.BufferedReader; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.util.ArrayList; |
import org.joda.time.DateTime; | |
import org.joda.time.DateTimeZone; | |
import org.joda.time.Duration; | |
import org.joda.time.Period; | |
class DatetimeDiffWithFormat{ | |
/** | |
* @param DateTime start | |
* @param DateTime end | |
* @param UnitDMYENUM unit |
def buildPMT(s): | |
""" | |
PartialMatchTable of string s | |
""" | |
prefix = [s[:i+1] for i in range(len(s)-1)] | |
postfix = [s[i+1:] for i in range(len(s)-1)] | |
intersection = list(set(prefix) & set(postfix)) | |
if intersection: | |
return len(intersection[0]) | |
return 0 |