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
import os | |
import datetime | |
from zbase62 import zbase62 | |
from mongoengine import * | |
from mongoengine.base import ValidationError | |
from mongoengine.queryset import OperationError | |
class RandomPKDocument(Document): | |
id = StringField(unique=True, primary_key=True) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
<CORSRule> | |
<AllowedOrigin>*</AllowedOrigin> | |
<AllowedMethod>GET</AllowedMethod> | |
<MaxAgeSeconds>3000</MaxAgeSeconds> | |
<AllowedHeader>Authorization</AllowedHeader> | |
<AllowedHeader>Content-*</AllowedHeader> | |
<AllowedHeader>Host</AllowedHeader> | |
</CORSRule> |
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
sqlite3 ~Library/Messages/chat.db "DELETE FROM message WHERE text LIKE '%File:///%';" |
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
class MimeRender(mimerender.FlaskMimeRender): | |
def __call__(self, *args, **kwargs): | |
ret = super(MimeRender, self).__call__(*args, **kwargs) | |
def wrap(target): | |
target._orig_func = target | |
return ret(target) | |
return wrap | |
mimerender = MimeRender() |
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
$lead = array('name' => 'test'); | |
$headers = array('Content-Type' => 'application/json'); | |
$options = array('auth' => array('YOUR_API_KEY', '')); | |
$request = Requests::post('https://api.close.com/api/v1/lead/', $headers, json_encode($lead), $options); |
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
<?php | |
/** | |
* Custom configuration bootsrtap file for ExpressionEngine | |
* | |
* Place config.php in your site root | |
* Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/config.php | |
* Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/database.php | |
* If you have moved your site root you'll need to update the require_once path | |
* |
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
from __future__ import division | |
import collections | |
from texttable import Texttable | |
by_status = collections.defaultdict(list) | |
per_page = 100 | |
offset = 0 | |
while True: |
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
while true; do | |
curl --silent --head https://developer.apple.com/membercenter/ | grep --silent maintenance | |
if [ $? -eq 0 ]; then; break; fi | |
sleep 3 | |
done | |
say "Apple Developer Center is Now Online"; |
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
import mimerender | |
mimerender.register_mime('pdf', ('application/pdf',)) | |
mimerender = mimerender.FlaskMimeRender(global_charset='UTF-8') | |
def render_pdf(html): | |
from xhtml2pdf import pisa | |
from cStringIO import StringIO | |
pdf = StringIO() | |
pisa.CreatePDF(StringIO(html.encode('utf-8')), pdf) |
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
var page = require('webpage').create(), | |
fs = require('fs'); | |
page.viewportSize = { width: 600, height: 600 }; | |
page.paperSize = { format: 'Letter', orientation: 'portrait', margin: '1cm' }; | |
page.content = fs.read('/dev/stdin'); | |
window.setTimeout(function() { | |
page.render('/dev/stdout', { format: 'pdf' }); |