Skip to content

Instantly share code, notes, and snippets.

View ikeikeikeike's full-sized avatar
🈵
Working

ikedat / Tatsuo Ikeda ikeikeikeike

🈵
Working
  • 3C
  • Tokyo, Japan
  • 00:14 (UTC +09:00)
View GitHub Profile
@ikeikeikeike
ikeikeikeike / gist:4704857
Last active December 12, 2015 03:09
Macports の New zsh 5.0.2 default option だとRVMが動かないので以下を足した - 完 -
$ sudo port edit zsh
>>>
configure.args --htmldir=${doc}/html \
--enable-libs="-lncurses" \
--enable-pcre \
--enable-cap \ # Add
--enable-regex \ # Add
--with-tcsetpgrp \
DL_EXT=bundle

PyConJP スケジュール@BPスピカ

恐らく間違っている可能性が大です。その場合勝手に書き換えちゃって下しあ。

Day 1

$ ps aux | grep "startvm" | awk '{print $13": "$15}'
@ikeikeikeike
ikeikeikeike / gist:3193547
Created July 28, 2012 14:09
apns check payload
import struct
def check_payload(string):
""" check payload
"""
if not isinstance(string, (str, unicode)):
return False
string = [string]
fmt = "!BH32sH%ds"
description "APNS server for push notify"
start on runlevel [2345]
stop on runlevel [!2345]
script
cd /tmp
exec twistd -n -r epoll web --class=pyapns.server.APNSServer --port=7077
end script
class Callback(object):
""" for callback """
def __init__(self, app, tokens, notifications):
self._app = app
self._tokens = tokens
self._notifications = notifications
def errback(self, err):
""" err
:param object err: Exception or xmlrpclib.Fault object
@ikeikeikeike
ikeikeikeike / gist:3171258
Created July 24, 2012 17:12
badge / sound
tokens = ["token1", "token2", "token3", "token4"]
notifications = [
{'aps':{'alert': 'Hello token 1', 'badge': 2, 'sound': 'flynn.caf'}},
{'aps':{'alert': 'Hello token 2', 'badge': 4, 'sound': 'flynn.caf'}},
{'aps':{'alert': 'Hello token 3', 'badge': 5, 'sound': 'flynn.caf'}},
{'aps':{'alert': 'Hello token 4', 'badge': 8, 'sound': 'flynn.caf'}},
]
notify('myapp', tokens, notifications) # push!!
tokens = ["token1", "token2", "token3", "token4"]
notifications = [
{'aps':{'alert': 'Hello token 1'}},
{'aps':{'alert': 'Hello token 2'}},
{'aps':{'alert': 'Hello token 3'}},
{'aps':{'alert': 'Hello token 4'}},
]
notify('myapp', tokens, notifications) # push!!
@ikeikeikeike
ikeikeikeike / gist:3171238
Created July 24, 2012 17:08
pyapns sample code
from pyapns import configure, provision, notify
configure({'HOST': 'http://localhost:7077/'})
provision('myapp', open('cert.pem').read(), 'sandbox')
notify('myapp', 'hexlified_token_str', {'aps':{'alert': 'Hello!'}})
@ikeikeikeike
ikeikeikeike / gist:3158666
Created July 22, 2012 06:23
Django MySQL AS句

チョイチョイ忘れる

>>> Message.objects.filter(pk=1).extra(select={'mailto': 'id'}).values("subject", "body", "mailfrom", "mailto")
[{'mailto': 1L, 'body': u'ldkajf', 'mailfrom': u'admin name', 'subject': u'title1'}]