Skip to content

Instantly share code, notes, and snippets.

View bashkirtsevich's full-sized avatar
:octocat:
bashkirtsevich.github.io

D.A.Bashkirtsev bashkirtsevich

:octocat:
bashkirtsevich.github.io
View GitHub Profile
@bashkirtsevich
bashkirtsevich / detect_smile.py
Last active February 25, 2017 16:34
Python OpenCV smile detector
import cv2
import numpy as np
import sys
facePath = "haarcascade_frontalface_default.xml"
smilePath = "haarcascade_smile.xml"
faceCascade = cv2.CascadeClassifier(facePath)
smileCascade = cv2.CascadeClassifier(smilePath)
cap = cv2.VideoCapture(0)
@bashkirtsevich
bashkirtsevich / opencv_install.md
Created February 25, 2017 16:25
Python OpenCV installation

Installation

  1. Dwonload and install NumPy (OpenCV v.3 required NumPy v.1.10)
  2. Download OpenCV
  3. Extract files from archive
  4. Goto opencv/build/python/2.7 folder
  5. Copy cv2.pyd to C:/Python27/lib/site-packeges
  6. Open python terminal and try this code:
>>> import cv2
>>> print cv2.__version__
@bashkirtsevich
bashkirtsevich / grapefruit.svg
Created April 2, 2017 04:42
grapefruit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from klein import Klein
app = Klein()
@app.route('/hleb')
def hleb(request):
return "pokushaem"
app.run('localhost', 8080)
@bashkirtsevich
bashkirtsevich / table_example.jrxml
Created April 3, 2017 08:04
JasperBI table example
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.1 -->
<!-- 2017-04-03T13:03:37 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="TableReport" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50" isSummaryWithPageHeaderAndFooter="true" uuid="4f644acf-b65a-459f-b852-0f55681c7389">
<property name="net.sf.jasperreports.print.create.bookmarks" value="true"/>
<property name="ireport.jasperserver.url" value="http://jasper.cloud134.parmalogica.ru:8080/jasperserver/"/>
<property name="ireport.jasperserver.user" value="jasperadmin"/>
<property name="ireport.jasperserver.reportUnit" value="/rep
from twisted.internet import protocol, reactor
host = 'localhost'
port = 777
class Twist_client(protocol.Protocol):
#Отправка сообщения с проверкой
def sendData(self):
data = raw_input('write message: ')
if data:
@bashkirtsevich
bashkirtsevich / proxy.py
Created April 5, 2017 05:07
Flask proxy
"""
A simple proxy server. Usage:
http://hostname:port/p/(URL to be proxied, minus protocol)
For example:
http://localhost:8080/p/www.google.com
"""
@bashkirtsevich
bashkirtsevich / demo.sql
Created April 7, 2017 10:25
Oracle load XML long character value and replace html escaping («&quot;»)
with t
as
(
select '"ю1"' as dummy from dual
)
select
dbms_xmlgen.convert(xmlagg (
xmlelement (
e,
t.dummy
@bashkirtsevich
bashkirtsevich / article.md
Last active April 13, 2023 01:03
MongoDB Indexing the Entire Document (Wildcard Indexing)

Indexing the Entire Document (Wildcard Indexing)

In the last example, we put a combined index on the subject and content fields. But there can be scenarios where you want any text content in your documents to be searchable.

For example, consider storing emails in MongoDB documents. In the case of emails, all the fields, including Sender, Recipient, Subject and Body, need to be searchable. In such scenarios you can index all the string fields of your document using the $** wildcard specifier.

The query would go something like this (make sure you are deleting the existing index before creating a new one):

db.messages.createIndex({"$**":"text"})

This query would automatically set up text indexes on any string fields in our documents. To test this out, insert a new document with a new field location in it:

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.