Skip to content

Instantly share code, notes, and snippets.

View Nazarii's full-sized avatar

Nazarii Gudzovatyi Nazarii

View GitHub Profile
syntax on " 1
set t_Co=256 " 1a
"" Colours for syntax highlighting (2)
" (a) If 256 colors not supported
hi Comment ctermfg=DarkGreen
hi Constant ctermfg=Magenta
" (b) If 256 colors supported
# If you use the GNU debugger gdb to debug the Python C runtime, you
# might find some of the following commands useful. Copy this to your
# ~/.gdbinit file and it'll get loaded into gdb automatically when you
# start it up. Then, at the gdb prompt you can do things like:
#
# (gdb) pyo apyobjectptr
# <module 'foobar' (built-in)>
# refcounts: 1
# address : 84a7a2c
# $1 = void
@Nazarii
Nazarii / poland_visa.py
Last active September 22, 2016 12:38
Poland visa registration service availability notification for Mac
!#/usr/bin/env python
import requests
import time
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
URL = 'https://polandonline.vfsglobal.com/poland-ukraine-appointment/(S(vvzibb45kxnimzfrnhuavib1))/AppScheduling/AppWelcome.aspx?P=s2x6znRcBRv7WQQK7h4MTjZiPRbOsXKqJzddYBh3qCA='
HEADERS = {'Host': 'polandonline.vfsglobal.com'}
str1 = 'x' * 10
str2 = 'x' * 10
str1 is str2 # Gives 'True'
# Now let's increase object's size a bit
str1 = 'x' * 100
str2 = 'x' * 100
str1 is str2 # Gives 'False', WTF?
# Python tries to cache everything up to specific size, that's why in the first example
class A():
def first(self):
print("Class A")
class B(A):
pass
class C(A):
def first(self):
print("Class C")
@Nazarii
Nazarii / test_network.py
Last active July 26, 2016 08:00
Network unitest
#!/usr/bin/env python
import unittest
import time
import netinfo
import threading
from scapy.all import send, sniff, conf, IP, TCP
UNIQUE_MESSAGE = 'Errors should never pass silently'
@Nazarii
Nazarii / json
Created December 30, 2015 15:21
Sublime config
{
"auto_complete": false,
"caret_style": "blink",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-OceanicNext.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"default_line_ending": "system",
"find_selected_text": true,
"fold_buttons": false,
"highlight_line": true,
@Nazarii
Nazarii / parse_yaplakal.py
Last active August 29, 2015 14:12
Scrap links & import to Wordpress
# -*- coding: cp1251 -*-
import httplib2
import MySQLdb as mdb
from BeautifulSoup import BeautifulSoup, SoupStrainer
STEP = 25
MAX_COUNTER = 3925
def import_links():
"""Method for scrapping images links for http://www.yaplakal.com
@Nazarii
Nazarii / podcasts_downloader.py
Last active August 29, 2015 14:11
Podcasts downloader
#!/usr/bin/env python
import urllib
import urllib2
import re
import os
__author__ = 'Nazarii Gudzovatyi <counter.sparta@gmail.com>'
__description = """Simple script for downloading all podcasts
from The art of programming (http://taop.rpod.ru/) site.
@Nazarii
Nazarii / holidays.py
Last active August 29, 2015 14:05 — forked from adamJLev/holidays.py
from dateutil import rrule
from datetime import datetime
def get_schedule_holidays_rrules():
return [
rrule.rrule(rrule.YEARLY, dtstart=datetime.now(), bymonth=1, bymonthday=1), # New Years
rrule.rrule(rrule.YEARLY, dtstart=datetime.now(), bymonth=5, byweekday=rrule.MO(-1)), # Memorial
rrule.rrule(rrule.YEARLY, dtstart=datetime.now(), bymonth=7, bymonthday=4), # Independence
rrule.rrule(rrule.YEARLY, dtstart=datetime.now(), bymonth=11, byweekday=rrule.TH(4)), # Thanksgiving
rrule.rrule(rrule.YEARLY, dtstart=datetime.now(), bymonth=12, bymonthday=25), # Christmas