http://twitter.com/share?text=<TITLE>&url=<URL>
E.g. http://twitter.com/share?text=This+is+google+a+search+engine&url=https%3A%2F%2Fwww.google.com
http://www.facebook.com/sharer.php?u=&p[title]=
(() => { | |
const MODE = 'publish_drafts'; | |
const DEBUG_MODE = true; | |
const MADE_FOR_KIDS = false; | |
const VISIBILITY = 'Unlisted'; | |
const SORTING_KEY = (one, other) => { | |
return one.name.localeCompare(other.name, undefined, {numeric: true, sensitivity: 'base'}); | |
}; | |
const TIMEOUT_STEP_MS = 20; | |
const DEFAULT_ELEMENT_TIMEOUT_MS = 10000; |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
class Color(object): | |
""" | |
reference from https://gist.github.com/Jossef/0ee20314577925b4027f and modified bit. | |
""" | |
def __init__(self, text, **user_styles): |
def color(text, **user_styles): | |
styles = { | |
# styles | |
'reset': '\033[0m', | |
'bold': '\033[01m', | |
'disabled': '\033[02m', | |
'underline': '\033[04m', | |
'reverse': '\033[07m', |
from email.mime.image import MIMEImage | |
import smtplib | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
class MailSender(object): | |
def __init__(self, username, password, server='smtp.gmail.com', port=587, use_tls=True): | |
self.username = username |
app.directive('ngEnter', function() { | |
return function(scope, element, attrs) { | |
element.bind("keydown keypress", function(event) { | |
if(event.which === 13) { | |
scope.$apply(function(){ | |
scope.$eval(attrs.ngEnter); | |
}); | |
event.preventDefault(); | |
} |
#!/usr/bin/env python | |
import os | |
import cmd | |
def file_auto_complete(text, line, begidx, endidx): | |
""" auto complete of file name. | |
""" | |
line = line.split() |
check process mongodb | |
with pidfile "/var/lib/mongodb/mongod.lock" | |
start program = "/sbin/start mongodb" | |
stop program = "/sbin/stop mongodb" | |
if failed port 28017 protocol http | |
and request "/" with timeout 10 seconds then restart | |
if 5 restarts within 5 cycles then timeout |