Skip to content

Instantly share code, notes, and snippets.

View bobuk's full-sized avatar

Grigory Bakunov bobuk

View GitHub Profile
@bobuk
bobuk / img.py
Last active March 31, 2024 22:58
Сегодня я вам покажу, как написать маленький скриптик, который умеет искать похожие фотографии. Зачем? Ну, если честно - совсем без причины.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Video of this screencast: https://vimeo.com/57296525
#
#
from __future__ import print_function, division, absolute_import
from PIL import Image as pImage
import numpy
@bobuk
bobuk / forswan.py
Created January 13, 2012 17:21
forswan
#!/usr/bin/python
import time, sys
iface="eth0" if len(sys.argv) < 2 else sys.argv[1]
_prev_in = 0
_prev_out = 0
print "With interface: " + iface
with open("/proc/net/dev") as f:
while True:
for row in f:
@bobuk
bobuk / speetter.py
Created October 20, 2011 13:27
Говорилка
# -*- coding: utf-8 -*-
import sys;reload(sys);sys.setdefaultencoding('utf-8')
import twitter
import time
import commands, itertools
consumer_key = ...
consumer_secret = ...
access_key = ...
from twisted.names import dns, server, client, cache
from twisted.application import service, internet
from twisted.internet import defer
from twisted.python import log
class disResolverBackend(client.Resolver):
def __init__(self, servers=None):
client.Resolver.__init__(self, servers=servers)
self.ttl = 5
@bobuk
bobuk / Base File.sublime-settings.json
Created September 14, 2011 16:24
Base settings for python. Please remove .json in filename.
{
"detect_indentation": false,
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "Cyrillic (Windows 1251)",
"font_face": "monofur",
"font_size": 18,
"highlight_line": true,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"use_tab_stops": true