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
on run {input, parameters} | |
set content to (input as text) | |
set AppleScript's text item delimiters to "\n" | |
set textList to every text item of content | |
set theTitle to item 1 of textList | |
tell application "Evernote" | |
create note title theTitle with text content notebook "default" | |
synchronize | |
end tell | |
display notification "Success" with title "Save to Evernote!" |
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
code = '12346830281720938x' # check sum equal 10, maped to 'x' | |
sum = 0 | |
for i in code[:-1]: | |
sum = ( sum + int(i, 10)) * 2 | |
sum_mod = sum % 11 | |
sum_check = (12 - sum_mod ) % 11 | |
sum_check = 'x' if sum_check == 10 else str(sum_check) | |
assert sum_check == code[-1] |
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
# read the codes commented by ph87 | |
def paginate_queryset(self, queryset, page_size=None): | |
""" | |
Paginate a queryset if required, either returning a page object, | |
or `None` if pagination is not configured for this view. | |
""" | |
deprecated_style = False | |
if page_size is not None: | |
warnings.warn('The `page_size` parameter to `paginate_queryset()` ' |
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
#!/bin/sh | |
# /etc/rc.d/init.d/redis-server | |
# From - http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/ | |
# | |
# redis - this script starts and stops the redis-server daemon | |
# Originally from - https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server | |
# | |
# chkconfig: - 85 15 | |
# description: Redis is a persistent key-value database | |
# processname: redis-server |
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/local/bin/python2.7 | |
#encoding:utf8 | |
import sys | |
import os | |
import datetime | |
import smtplib | |
from email.mime.text import MIMEText | |
from email.header import Header | |
from optparse import OptionParser |
NewerOlder