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
;(function($, window, document, undefined) { | |
"use strict"; | |
// Default options | |
var pluginName = "pluginName", //plugin name that will be use in $(element).pluginName | |
defaults = { | |
// Options | |
// Events | |
}; |
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
=DATEVALUE(LEFT(A1,10)) | |
+ TIMEVALUE(MID(A1,12,8)) | |
+ IF("Z"=MID(A1,20,LEN(A1)-19),0,(INT(MID(A1,20,LEN(A1)-19)/100)*60+MOD(MID(A1,20,LEN(A1)-19),100))/1440) | |
# Credit http://www.kddart.org/help/kdsmart/html/excel-support.html |
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 asyncio | |
import cv2 | |
from aiohttp import web, MultipartWriter | |
async def mjpeg_handler(request): | |
boundary = "boundarydonotcross" | |
response = web.StreamResponse(status=200, reason='OK', headers={ | |
'Content-Type': 'multipart/x-mixed-replace; ' | |
'boundary=--%s' % boundary, |
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
cmake -D CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/usr/local \ | |
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ | |
-D PYTHON3_EXECUTABLE=$(which python3) \ | |
-D PYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \ | |
-D PYTHON_INCLUDE_DIR2=$(python3 -c "from os.path import dirname; from distutils.sysconfig import get_config_h_filename; print(dirname(get_config_h_filename()))") \ | |
-D PYTHON_LIBRARY=$(python3 -c "from distutils.sysconfig import get_config_var;from os.path import dirname,join ; print(join(dirname(get_config_var('LIBPC')),get_config_var('LDLIBRARY')))") \ | |
-D PYTHON3_NUMPY_INCLUDE_DIRS=$(python3 -c "import numpy; print(numpy.get_include())") \ | |
-D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \ | |
-D BUILD_opencv_python2=OFF \ |
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 Image, ImageDraw | |
def get_colors(infile, outfile, numcolors=10, swatchsize=20, resize=150): | |
image = Image.open(infile) | |
image = image.resize((resize, resize)) | |
result = image.convert('P', palette=Image.ADAPTIVE, colors=numcolors) | |
result.putalpha(0) | |
colors = result.getcolors(resize*resize) |
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
function csvBlob(rows, export_bom) { | |
const BOM = '\ufeff'; // Utf-8 Bytes order mark | |
return new Blob([(export_bom ? BOM : '') + rows.map(function(row) { | |
return row.map(function(col) { | |
return ['"', col.replace(/"/gi, '""'), '"'].join(''); | |
}).join(',') | |
}).join('\n')], {type: 'text/csv;charset=utf-8;'}); | |
} | |
const blob = csvBlob(temp1); |
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
db.getCollection('article').aggregate([ | |
{$match: {$or: [ | |
{"view.sections.parts.embed.provider_name": {$in: ['Commerce Product', 'Image With Hotspots', 'Commerce Product Group']}}, | |
{"view.sections.steps.parts.embed.provider_name": {$in: ['Commerce Product', 'Image With Hotspots', 'Commerce Product Group']}} | |
]}}, | |
{$project: {_id: 1} | |
]) | |
db.getCollection('article').aggregate([ | |
{$match: {$or: [ |
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 print_function | |
from sys import getsizeof, stderr | |
from itertools import chain | |
from collections import deque | |
try: | |
from reprlib import repr | |
except ImportError: | |
pass | |
def total_size(o, handlers={}, verbose=False): |
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 math | |
from cStringIO import StringIO | |
class Heap(object): | |
''' index from parent | |
0 0 | |
1 2 0*2+1=1 0*2+2=2 | |
3 4 5 6 1*2+1=3 1*2+2=4 2*2+1=5 2*2+1=6 | |
7 8 9 10 11 12 13 14 3*2+1=7 |
OlderNewer