NSData* imageData = [contentImage TIFFRepresentation]; NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; [pasteboard declareTypes:[NSArray arrayWithObjects:NSPasteboardTypeTIFF, nil] owner:nil]; [pasteboard setData:imageData forType:NSTIFFPboardType];
NSString *const NSPasteboardTypeString; NSString *const NSPasteboardTypePDF; NSString *const NSPasteboardTypeTIFF; NSString *const NSPasteboardTypePNG; NSString *const NSPasteboardTypeRTF; NSString *const NSPasteboardTypeRTFD; NSString *const NSPasteboardTypeHTML; NSString *const NSPasteboardTypeTabularText; NSString *const NSPasteboardTypeFont; NSString *const NSPasteboardTypeRuler; NSString *const NSPasteboardTypeColor; NSString *const NSPasteboardTypeSound; NSString *const NSPasteboardTypeMultipleTextSelection; NSString *const NSPasteboardTypeFindPanelSearchOptions;
#!/usr/bin/env python
# encoding: utf-8
"""
GAnalytics.py
Created by mmiyajix on 2011-10-02.
Copyright (c) mmiyajix. All rights reserved.
"""
import datetime, sys
import gdata.analytics.client
email="YOUR_EMAIL_ADDR"
password="YOUR_EMAIL_PASSWORD"
table_id = 'ga:xxxxxx'
days = 30
span = 10
offset = 1
args = sys.argv
if len(args) > 1:
days = int(args[1])
span = int(args[2])
offset = int(args[3])
SOURCE = 'GData sample client-v2'
client = gdata.analytics.client.AnalyticsClient(source=SOURCE)
client.client_login(email, password, source=SOURCE, service=client.auth_service)
today = datetime.date.today() - datetime.timedelta(days=offset)
lastmonth = today - datetime.timedelta(days=days)
data_query = gdata.analytics.client.DataFeedQuery({
'ids': table_id,
'start-date': lastmonth.isoformat(),
'end-date': today.isoformat(),
'dimensions': 'ga:pagePath',
'metrics': 'ga:pageviews,ga:uniquePageviews,ga:visits,ga:bounces',
'sort': '-ga:pageviews',
'filters': 'ga:pagePath=~(^/isreport/entry/.+|^/report/.+)',
'max-results': str(span),
})
feed = client.GetDataFeed(data_query)
print '{ "entries":['
for count,entry in enumerate(feed.entry):
print '{"url":',
for dim in entry.dimension:
url = str(dim.value)
print '"'+url+'"',
for j in entry.metric:
print ',"'+j.name+'":',j.value,
print '}',
if count < len(feed.entry)-1:
print ','
print '],'
print '"start-date":"', lastmonth.isoformat(),'",'
print '"end-date":"', today.isoformat(),'"',
print '}'{ "entries":[
{"url": "/report/2010/7/20/2010015005/index.html" ,"ga:pageviews": 448 ,"ga:uniquePageviews": 406 ,"ga:visits": 385 ,"ga:bounces": 228 } ,
{"url": "/report/2010/11/6/2010033003/index.html" ,"ga:pageviews": 432 ,"ga:uniquePageviews": 379 ,"ga:visits": 376 ,"ga:bounces": 330 } ,
{"url": "/report/2011/5/11/2011266002/index.html" ,"ga:pageviews": 236 ,"ga:uniquePageviews": 215 ,"ga:visits": 215 ,"ga:bounces": 194 } ,
{"url": "/report/2010/11/8/2010015006/index.html" ,"ga:pageviews": 177 ,"ga:uniquePageviews": 176 ,"ga:visits": 57 ,"ga:bounces": 40 } ,
{"url": "/report/2011/2/10/2011016006/index.html" ,"ga:pageviews": 167 ,"ga:uniquePageviews": 147 ,"ga:visits": 129 ,"ga:bounces": 101 } ,
{"url": "/report/2011/5/12/2011271002/index.html" ,"ga:pageviews": 149 ,"ga:uniquePageviews": 142 ,"ga:visits": 139 ,"ga:bounces": 132 } ,
{"url": "/report/2011/5/13/2011267001/index.html" ,"ga:pageviews": 135 ,"ga:uniquePageviews": 117 ,"ga:visits": 115 ,"ga:bounces": 100 } ,
{"url": "/report/2011/5/31/2011272002/index.html" ,"ga:pageviews": 133 ,"ga:uniquePageviews": 114 ,"ga:visits": 113 ,"ga:bounces": 101 } ,
{"url": "/report/2011/5/6/2011021007/index.html" ,"ga:pageviews": 123 ,"ga:uniquePageviews": 105 ,"ga:visits": 105 ,"ga:bounces": 92 } ,
{"url": "/report/2011/5/3/2011270001/index.html" ,"ga:pageviews": 108 ,"ga:uniquePageviews": 99 ,"ga:visits": 99 ,"ga:bounces": 91 } ],
"start-date":" 2011-09-10 ",
"end-date":" 2011-10-10 " }
for i in {1..200};
do
echo `date --date "${i} day ago" +%F`_30.log ;
python GAnalytics.py 30 50 ${i} > log/`date --date "${i} day ago" +%F`_30.log ;
done$ python manage.py datadump APP_NAME > dump.json
$ python manage.py reset APP_NAME $ python manage.py syncdb
$ python manage.py loaddata dump.json
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
skyper.py
Created by mmiyaji on 2010-04-20.
Copyright (c) 2010 __ISDL__. All rights reserved.
"""
import os,re,time
import commands
import Skype4Py
ssids = {u"m-net":u"home",u"air-kc":u"KC104",
u"AIR-IN":u"IN223N",u"AIR-IN206":u"IN206",u"AIR-IN221N":u"IN221"}
class Skyper:
def __init__(self, mood=""):
self.mood = mood
def set_mood(self, mood):
self.mood = mood
def get_ssid(self):
ssid = commands.getoutput("/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport"+
" --getinfo | grep SSID | tail -n 1")
ssid = ssid.replace(" ","")
ids = ssid.partition(":")
ssid = ids[2]
return ssid
def check(self, message, mood=""):
now_mood = ""
if mood:
now_mood = mood
else:
now_mood = self.mood
if message != now_mood and message:
return True
else:
return False
def replace_ssid(self, name):
ssid = ""
if name in ssids:
ssid = ssids[name]
else:
ssid = name
return ssid
if __name__ == '__main__':
isloop = False
skype = Skype4Py.Skype()
sk = Skyper()
while True:
profile = skype._GetCurrentUserProfile()
sk.set_mood(profile.MoodText)
message = sk.get_ssid().lstrip()
message = u"@"+sk.replace_ssid(message)
if sk.check(message.lstrip()):
profile._SetMoodText(message)
print "ChangeMood: "+profile.MoodText
else:
print "SameMood: "+profile.MoodText
if not isloop:
break
else:
time.sleep(60*10)$ defaults write com.apple.versioner.python Prefer-32-Bit -bool yes$ defaults write com.apple.versioner.python Prefer-32-Bit -bool no
<div id="fb-root">
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments id="fb_comment" href="http://mmiyajix.appspot.com" width="630"></fb:comments>
<script type="text/javascript">
document.getElementById("fb_comment").href=location.href
</script>
</div><div id="comments">
<h2>Facebook Comments:</h2>
<div id="fb-root"><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script></div>
</div>
<script type="text/javascript">
$("#fb-root").after('<fb:comments id="fb_comment" href="'+location.href+'" width="630"></fb:comments>');
</script><div id="social_button">
<div id="tw-root">
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</div>
<div id="gl-root">
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<g:plusone size="medium"></g:plusone>
</div>
<div id="hb-root">
<a id="hb_like" href="http://b.hatena.ne.jp/entry/" class="hatena-bookmark-button" data-hatena-bookmark-layout="standard" title="このエントリーをはてなブックマークに追加">
<img src="http://b.st-hatena.com/images/entry-button/button-only.gif" alt="このエントリーをはてなブックマークに追加" width="20" height="20" style="border: none;" />
</a>
<script type="text/javascript" src="http://b.st-hatena.com/js/bookmark_button.js" charset="utf-8" async="async"></script>
<script type="text/javascript">document.getElementById("hb_like").href="http://b.hatena.ne.jp/entry/"+location.href</script>
</div>
<div id="fb-root1">
<iframe id="fb_like" src="" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowtransparency="true"></iframe>
<script type="text/javascript">document.getElementById("fb_like").src="http://www.facebook.com/plugins/like.php?href="+location.href+"&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light&width=120"</script>
</div>
</div>#social_button{
float:right;
}
#social_button > div{
float:left;
min-width:70px;
} <div id="fb-root"><script src="http://connect.facebook.net/en_US/all.js#appId=120147571407250&xfbml=1"></script><fb:like id="fb_script" href="" send="true" layout="button_count" width="100" show_faces="false" font=""></fb:like>
<script type="text/javascript">document.getElementById("fb_script").href=location.href</script></div><div id="dl-root">
<a href="http://www.delicious.com/save" onclick="window.open('http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;">
<img src="http://l.yimg.com/hr/img/delicious.small.gif" height="20" alt="Delicious" />
</a>
</div>$ ab -n 1000 -c 64 http://mmiyajix.appspot.com/rss.xml
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking mmiyajix.appspot.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: Google
Server Hostname: mmiyajix.appspot.com
Server Port: 80
Document Path: /rss.xml
Document Length: 69981 bytes
Concurrency Level: 64
Time taken for tests: 56.470 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 70234830 bytes
HTML transferred: 70049645 bytes
Requests per second: 17.71 [#/sec] (mean)
Time per request: 3614.095 [ms] (mean)
Time per request: 56.470 [ms] (mean, across all concurrent requests)
Transfer rate: 1214.60 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 55 112 41.5 106 367
Processing: 1082 3387 2000.6 3133 14319
Waiting: 775 2904 1985.0 2668 13994
Total: 1183 3499 2000.1 3246 14436
Percentage of the requests served within a certain time (ms)
50% 3246
66% 4028
75% 4504
80% 4847
90% 5792
95% 6689
98% 9778
99% 11692
100% 14436 (longest request)
$ ab -n 1000 -c 64 http://mmiyajix.appspot.com/rss.xml
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking mmiyajix.appspot.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: Google
Server Hostname: mmiyajix.appspot.com
Server Port: 80
Document Path: /rss.xml
Document Length: 69981 bytes
Concurrency Level: 64
Time taken for tests: 50.247 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 70397413 bytes
HTML transferred: 70211673 bytes
Requests per second: 19.90 [#/sec] (mean)
Time per request: 3215.785 [ms] (mean)
Time per request: 50.247 [ms] (mean, across all concurrent requests)
Transfer rate: 1368.20 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 56 178 99.1 169 1082
Processing: 1185 2910 1689.0 2365 11797
Waiting: 728 2100 1535.0 1537 10923
Total: 1259 3088 1681.6 2555 11991
Percentage of the requests served within a certain time (ms)
50% 2555
66% 3145
75% 3566
80% 3925
90% 5015
95% 7419
98% 7957
99% 9108
100% 11991 (longest request)