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 / 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 / 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 / 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 / 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 / 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+)')
### 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 / 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
);
@maksymx
maksymx / userChrome.css
Created February 24, 2017 08:56 — forked from AnthonyDiGirolamo/userChrome.css
thunderbird custom style for message and folder pane list
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/* Set Font Size In Folder Pane */
#folderTree >treechildren::-moz-tree-cell-text {
/*font-family: Lucida Sans !important;*/
font-size: 12pt !important; }
/* Set Font Size In Thread Pane */
@maksymx
maksymx / main.py
Created April 22, 2017 18:52 — forked from miloharper/main.py
A two layer neural network written in Python, which trains itself to solve a variation of the XOR problem.
from numpy import exp, array, random, dot
class NeuronLayer():
def __init__(self, number_of_neurons, number_of_inputs_per_neuron):
self.synaptic_weights = 2 * random.random((number_of_inputs_per_neuron, number_of_neurons)) - 1
class NeuralNetwork():
def __init__(self, layer1, layer2):
import urllib2
from multiprocessing.dummy import Pool as ThreadPool
urls = [
'http://www.python.org',
'http://www.python.org/about/',
'http://www.onlamp.com/pub/a/python/2003/04/17/metaclasses.html',
'http://www.python.org/doc/',
'http://www.python.org/download/',
'http://www.python.org/getit/',