Skip to content

Instantly share code, notes, and snippets.

View alice1017's full-sized avatar

Alice1017 alice1017

  • Tokyo, Japan
View GitHub Profile
@alice1017
alice1017 / getcode.py
Created January 12, 2011 14:07
get code of gist.
#!/usr/bin/python
#coding:utf-8
import sys
import usable # <- it's my module. Please look gist:770826
import urllib
from BeautifulSoup import BeautifulSoup
try:
url = sys.argv[1]
@alice1017
alice1017 / ux_nu.py
Created January 16, 2011 06:39
短縮URLサービスux.nuを使ってurlを短縮
#!/usr/bin/python
#coding:utf-8
import urllib
import sys
import json
def getlink(site):
url = "http://ux.nu/api/short"
param = urllib.urlencode({"url":site})
@alice1017
alice1017 / redirect.py
Created February 14, 2011 01:36
redirect a output
#!/usr/bin/python
#coding:utf-8
import sys,types
from StringIO import StringIO
class Redirect:
def __init__(self):
sys.stdout = StringIO()
self.stdout = sys.stdout
@alice1017
alice1017 / test.js
Created June 17, 2011 14:16
sample nodejs script
var html = require("html");
var base_header = new Object({
"Content-Type":"text/html;charset=utf-8"
});
var server = html.createServer();
server.on("request",function(req,res){
res.writeHead(200,base_header);
@alice1017
alice1017 / operate.js
Created June 26, 2011 04:13
operate form
$(function(){
var titleSelecter = $("#title");
var codeSelecter = $("#code");
var errorMsg = "Empty!";
$("#submit").click(function(){
if ( titleSelecter.val().length == 0 ){
@alice1017
alice1017 / webapp.py
Created September 3, 2011 13:45
miteru-client
#!/usr/bin/env python
#coding: utf-8
from google.appengine.ext import webapp
class webHandler(webapp.RequestHandler):
def write(self, var):
if isinstance(var, str):
self.response.out.write(var)
elif isinstance(var, tuple):
#!/usr/bin/env python
#coding:utf-8
import commands
import sys
try:
file = sys.argv[1]
except:
print "movietomp3.py [filename]"
@alice1017
alice1017 / gist:1378838
Created November 19, 2011 13:33
hello.py
def hello():
print "hello world"
@alice1017
alice1017 / gist:1427471
Created December 3, 2011 16:13
gettitle.py
#!/usr/bin/env python
#coding: utf-8
import urllib
import cgi
import os
import json
import re
import sys
@alice1017
alice1017 / gist:1447401
Created December 8, 2011 15:53
showbox.js
$(function(){
$("span#search_box").click(
function(){
if ($("span#search").css("display") == "none"){
$("span#search").slideDown("nomal");
}
else {
$("span#search").slideUp("nomal");
}
});