понедельник, 28 апреля 2014 г.

Как остановить bottle.py

Запускаем bottle.py в отдельном процессе. Сохраняем pid этого процесса. При возникновении необходимости остановить bottle.py - посылаем SIGTERM процессу.

import os
from multiprocessing import Process
import bottle

p = Process(target=bottle.run, kwargs={'quiet': True})
p.start()
os.kill(p.pid, 15)

четверг, 17 апреля 2014 г.

Помидоров, рельсов, простынь...

Помидоров, рельсов, простынь, кочерёг, доньев

«Поезд вез тонну помидоров и сошел с рельсов»
«Не простынь без простынь»

пятница, 11 апреля 2014 г.

Python: определена ли переменная

Вы не должны быть в такой ситуации, где вы не знаете определена переменная или нет.
«Your solution is wrong because the premise of the question is wrong: you shouldn't be in a situation where you don't know if a variable is defined.»
http://stackoverflow.com/questions/1592565/determine-if-variable-is-defined-in-python 

воскресенье, 6 апреля 2014 г.

Разница между Line in & Mic in

Line in will usually be stereo and about 10Kohm impedance.
Mic in is mono and about 600-1Kohm impedance and expecting SIGNIFICANTLY lower levels than the line, as it has a preamp to pick up the very low levels present in a microphone.

http://sound.stackexchange.com/questions/27539/difference-between-microphone-and-line-in-inputs

Fuck the system

...
Другое дело — как именно избегать чего-либо, пропаганды, например. Нужно изучить явление пропаганды и манипуляций изнутри, чтобы понять, как они работают, и как не поддаться. Ты говоришь, что нельзя верить никому, что любая масс-медиа информация — ложь. Но ведь хорошая пропаганда — правдивая пропаганда. Продукция нацистской пропаганды до сих пор считается классическим образцом. Например, как насаждалась юдофобия? Чтобы немцы уверовали в то, что все зло в мире от жЫдов, ничего не надо было сочинять, достаточно было говорить исключительно правду, правду, и ничего коме правды. Например, если какое-либо преступление в Германии совершал еврей, нацистская пресса живописала его во всех красках. Евреев в рейхе было предостаточно, были среди них и профессиональные преступники, убийцы, маньяки, аферисты, фальшивомонетчики, проститутки и сутенеры, женщины, случалось, убивали новорожденных детей и т.д. Вот об этом пресса и писала с упоением и страстью. В наше время очень сложно избегать подобного, мы не можем слезть с этого крючка так просто, единственный выход — полная информационная изоляция, что примерно соответствует уходу в лес и отшельничеству.

воскресенье, 2 марта 2014 г.

Дядя Вася

Вчера утром мне позвонила бабушка и сказала, что умер дядя. Дядя Вася жил вместе с ней и она была очень в расстроенных чувствах. Нужно было собирать его друзей на похороны, но она не могла себя заставить рыться в его вещах. Вот меня и назначили на эту должность (все равно ничего не делаешь, иди бабке помоги).

Распаковывание упакованных кортежей

«Благодаря этому существует возможность использовать встроенную функцию zip для распаковывания упакованных кортежей, передавая ей результаты другого вызова функции zip.»
Марк Лутц. Изучаем Python

«От дебила до DBA». Геннадий Гурвиц


пятница, 28 февраля 2014 г.

You can't parse [X]HTML with regex...

You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML. Regular expressions are a tool that is insufficiently sophisticated to understand the constructs employed by HTML. HTML is not a regular language and hence cannot be parsed by regular expressions. Regex queries are not equipped to break down HTML into its meaningful parts. so many times but it is not getting to me. Even enhanced irregular regular expressions as used by Perl are not up to the task of parsing HTML. You will never make me crack. HTML is a language of sufficient complexity that it cannot be parsed by regular expressions. Even Jon Skeet cannot parse HTML using regular expressions. Every time you attempt to parse HTML with regular expressions, the unholy child weeps the blood of virgins, and Russian hackers pwn your webapp. Parsing HTML with regex summons tainted souls into the realm of the living. HTML and regex go together like love, marriage, and ritual infanticide. The <center> cannot hold it is too late. The force of regex and HTML together in the same conceptual space will destroy your mind like so much watery putty. If you parse HTML with regex you are giving in to Them and their blasphemous ways which doom us all to inhuman toil for the One whose Name cannot be expressed in the Basic Multilingual Plane, he comes. HTML-plus-regexp will liquify the n​erves of the sentient whilst you observe, your psyche withering in the onslaught of horror. Rege̿̔̉x-based HTML parsers are the cancer that is killing StackOverflow it is too late it is too late we cannot be saved the trangession of a chi͡ld ensures regex will consume all living tissue (except for HTML which it cannot, as previously prophesied) dear lord help us how can anyone survive this scourge using regex to parse HTML has doomed humanity to an eternity of dread torture and security holes using regex as a tool to process HTML establishes a breach between this world and the dread realm of c͒ͪo͛ͫrrupt entities (like SGML entities, but more corrupt) a mere glimpse of the world of reg​ex parsers for HTML will ins​tantly transport a programmer's consciousness into a world of ceaseless screaming, he comes, the pestilent slithy regex-infection wil​l devour your HT​ML parser, application and existence for all time like Visual Basic only worse he comes he comes do not fi​ght he com̡e̶s, ̕h̵i​s un̨ho͞ly radiańcé destro҉ying all enli̍̈́̂̈́ghtenment, HTML tags lea͠ki̧n͘g fr̶ǫm ̡yo​͟ur eye͢s̸ ̛l̕ik͏e liq​uid pain, the song of re̸gular exp​ression parsing will exti​nguish the voices of mor​tal man from the sp​here I can see it can you see ̲͚̖͔̙î̩́t̲͎̩̱͔́̋̀ it is beautiful t​he final snuffing of the lie​s of Man ALL IS LOŚ͖̩͇̗̪̏̈́T ALL I​S LOST the pon̷y he comes he c̶̮omes he comes the ich​or permeates all MY FACE MY FACE ᵒh god no NO NOO̼O​O NΘ stop the an​*̶͑̾̾​̅ͫ͏̙̤g͇̫͛͆̾ͫ̑͆l͖͉̗̩̳̟̍ͫͥͨe̠̅s ͎a̧͈͖r̽̾̈́͒͑e n​ot rèaͨl̘̝̙̃ͤ͂̾̆ ZA̡͊͠͝LGΌ ISͮ̂҉̯͈͕̹̘̱ TO͇̹̺ͅƝ̴ȳ̳ TH̘Ë͖́̉ ͠P̯͍̭O̚​N̐Y̡ H̸̡̪̯ͨ͊̽̅̾̎Ȩ̬̩̾͛ͪ̈́̀́͘ ̶̧̨̱̹̭̯ͧ̾ͬC̷̙̲̝͖ͭ̏ͥͮ͟Oͮ͏̮̪̝͍M̲̖͊̒ͪͩͬ̚̚͜ES̨̥̫͎̭ͯ̿̔̀ͅ


http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454

среда, 26 февраля 2014 г.

глубокий метафизический смысл...


...
>>> True + 4
5

Так как, скорее всего, вам не придется встречаться на практике с выражениями, такими как последнее выражение в примере, вы можете спокойно игнорировать его глубокий метафизический смысл...

Марк Лутц. - Изучаем Python (4-е издание)

среда, 19 февраля 2014 г.

понедельник, 17 февраля 2014 г.

Катастрофа шатла Columbia



1 февраля 2003 года.

PLT (Willie McCool): OK Houston, we're gonna start APUs 1 and 3 now.
CAPCOM (Charlie Hobaugh): And Willie, we're with you on remaining APU start.
CAPCOM: And Columbia, the Hyd Fluid Thermal Conditioning will not be required today... we'll meet you on the cards
PLT: We copy Houston, Hyd Fluid Thermal Conditioning not required and we copy going to the cards.
CAPCOM: And Rick, don't wanna lead you astray, and don't forget the stuff on page 3-44.
CDR (Rick Husband): Alright we're checking that, we got the flight controller power on and we're working through the rest of it as well, thanks.
CAPCOM: Sounds good.
CAPCOM: Columbia, Houston, for Rick we'll take another ITEM 27 please
CAPCOM: Columbia, Houston, comm check.
CAPCOM: Columbia, Houston, UHF comm check...

http://www.nasa.gov/pdf/298870main_SP-2008-565.pdf - исследование возможности выживание экипажа Columbia