This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var server = http.createServer(function(req,res){ | |
res.writeHead(200, {'Content-type': 'text/plain'}) | |
res.end("hello world\n"); | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import os.path | |
import time | |
import urllib2 | |
import codecs | |
# python download url and save it to your compputer from a txt file | |
dirname = "/Users/papachan/Desktop/site/static/" | |
filename = "url.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MySQLdb | |
if __name__ == "__main__": | |
db = MySQLdb.Connect(host="localhost", user="user",passwd="",db="mysqldbname") | |
cursor = db.cursor() | |
cursor.execute("SHOW ENGINES") | |
for row in cursor.fetchall(): | |
print row |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MySQLdb | |
sql = """INSERT INTO table ( value_1 , created_at , value_2 , text ) VALUES (%s,%s,%s,%s,%s)""" | |
if __name__ == "__main__": | |
db = MySQLdb.Connect(host="127.0.0.1", user="admin",passwd="",db="mysql_dbname") | |
c = db.cursor() | |
try : | |
c.execute(sql, ('value', '0000-00-00 00:00:00', 'value 2', 'my etxt')) | |
db.commit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MySQLdb | |
def main(first): | |
sql = """SELECT * FROM `articles_autores` | |
ORDER BY article_id ASC | |
LIMIT %s""" | |
sql3 = """DELETE FROM `articles_autores` WHERE articles_autores.id = %s;""" | |
db = MySQLdb.connect(host='localhost', user='user',passwd='',db='test_duplicate'); | |
cursor = db.cursor() | |
cursor.execute(sql % first) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import re | |
import subprocess | |
av = list(sys.argv) | |
av[0] = "ant" | |
p = subprocess.Popen(av, stdout = subprocess.PIPE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
import time, subprocess, os, sys, platform | |
except Exception as e: | |
sys.stderr.write(str(e)) | |
exit(84) | |
def log_msg(msg): | |
log=open("log","a") | |
log.write(str(msg)+"\n") | |
log.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
V/python ( 3896): Extracting public assets. | |
D/dalvikvm( 3896): GC_FOR_ALLOC freed 1266K, 21% free 9353K/11719K, paused 12ms | |
I/dalvikvm-heap( 3896): Grow heap (frag case) to 10.194MB for 1048592-byte allocation | |
D/dalvikvm( 3896): GC_FOR_ALLOC freed 1K, 12% free 10375K/11719K, paused 13ms | |
I/python ( 3896): extracting background.png | |
E/python ( 3896): could not open /mnt/sdcard/org.kivy.sshshell/background.png | |
D/TextLayoutCache( 3896): Using debug level: 0 - Debug Enabled: 0 | |
D/dalvikvm( 3896): GC_CONCURRENT freed 26K, 12% free 10388K/11719K, paused 3ms+3ms | |
W/python ( 3896): java.io.IOException: open failed: EACCES (Permission denied) | |
W/python ( 3896): at java.io.File.createNewFile(File.java:940) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kivy | |
kivy.require('1.5.0') | |
import kivy.core.window | |
from kivy.config import Config | |
from kivy.app import App | |
from kivy.uix.floatlayout import FloatLayout | |
class MainUI(FloatLayout): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'), | |
path = require('path'), | |
http = require('http'), | |
redis = require('redis'), | |
path = require('path'), | |
url = require('url'); | |
function contains(arr,obj) { | |
return (arr.indexOf(obj) != -1); | |
} |
OlderNewer