Skip to content

Instantly share code, notes, and snippets.

View maksymx's full-sized avatar
🐍
I may be slow to respond.

Maksym L maksymx

🐍
I may be slow to respond.
View GitHub Profile
@maksymx
maksymx / postgres_jsonb.md
Last active November 12, 2016 18:43
postgres_jsonb.md

Yesterday, I discovered how you can enable jsonb in postgres/psycopg2. Today, I experimented around with how to query the data in json columns. There is documentation, but it wasn’t initially clear to me how the different operations worked.

CREATE TABLE json_test (
  id serial primary key,
  data jsonb
);
### Keybase proof
I hereby claim:
* I am maksymx on github.
* I am maksym_x (https://keybase.io/maksym_x) on keybase.
* I have a public key whose fingerprint is 24FE F391 8027 BB6C 8F0A 9DCA 818A 55C5 89C0 FCCD
To claim this, I am signing this object:
@maksymx
maksymx / incapsula.py
Created September 14, 2016 21:35
Incapsula security walkthrough for Volcom.com
# -*- coding: utf-8 -*-
import re
import urllib2
from random import random
from datetime import datetime, timedelta
KEY = re.compile(r'(\w+).+')
VALUE = re.compile(r'\w+\=(\S+)')
@maksymx
maksymx / install_opencv_2.4.11_fedora.sh
Created April 5, 2016 10:55
Install OpenCV 2.4.11 Fedora 21
yum install cmake
yum install python-devel numpy
yum install gcc gcc-c++
yum install gtk2-devel libdc1394-devel libv4l-devel ffmpeg-devel gstreamer-plugins-base-devel libpng-devel libjpeg-turbo-devel jasper-devel openexr-devel
yum install libtiff-devel libwebp-devel tbb-devel eigen3-devel python-sphinx texlive
pushd /tmp
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.11/opencv-2.4.11.zip
unzip opencv-2.4.11.zip
cd opencv-2.4.11
@maksymx
maksymx / subnet.py
Created March 28, 2016 12:01 — forked from nboubakr/subnet.py
A simple python script converts a Classless Inter-Domain Routing (CIDR)-formatted IP address into an IP range and netmask.
#!/usr/bin/env python
# python subnet.py 200.100.33.65/26
import sys
# Get address string and CIDR string from command line
(addrString, cidrString) = sys.argv[1].split('/')
# Split address into octets and turn CIDR into int
addr = addrString.split('.')
@maksymx
maksymx / db.create.user.js
Created February 10, 2016 08:21 — forked from veysiertekin/db.create.user.js
Mongo DB - usefull tricks
// select db
use test;
// create a user with db role(s) (http://docs.mongodb.org/manual/reference/built-in-roles/)
db.createUser( { user: "test", pwd: "changeit", roles: [ { role: "dbOwner", db: "test" } ] } );
@maksymx
maksymx / proxy.py
Created September 9, 2015 15:24
Urllib2 opener via proxy
import urllib2
proxy_server = 'http://username:password@ip_address:port'
proxy_handler = urllib2.ProxyHandler({"http": proxy_server, "https": proxy_server})
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookie_jar), proxy_handler)
@maksymx
maksymx / python_soap.md
Last active September 8, 2015 13:32 — forked from diyan/python_soap.md

Python. SOAP services

SOAP services. Overview

Evaluating Tools for Developing with SOAP in Python. Doug Hellmann - http://doughellmann.com/2009/09/01/evaluating-tools-for-developing-with-soap-in-python.html

What's the best SOAP client library for Python, and where is the documentation for it? - http://stackoverflow.com/questions/206154/whats-the-best-soap-client-library-for-python-and-where-is-the-documentation-f

What's the best SOAP library for Python 3.x? - http://stackoverflow.com/questions/7817303/whats-the-best-soap-library-for-python-3-x

@maksymx
maksymx / Python_Test_task.py
Created July 18, 2015 16:48
SECL group test task
# coding=utf-8
TEST = True # установите True, чтобы запустить проверку
"""
***********************************************
Написать два класса: сотрудник и команда.
Сотрудник имеет имя, стоимость работы (долларов в час) и уровень квалификации (от 0 до 9).
Если сложить сотрудников (оператор +), то будет создана команда, которая будет иметь уровень
квалификации (максимальный уровень из всех сотрудников в команде), стоимость (сумма стоимости
всех сотрудников команды) и список всех сотрудников.
@maksymx
maksymx / singleton.py
Last active August 29, 2015 14:22 — forked from shelling/singleton.py
#!/usr/bin/env python
class Hello(object):
singleton = None
def __new__(clz):
if not clz.singleton:
clz.singleton = object.__new__(clz)
return clz.singleton