Skip to content

Instantly share code, notes, and snippets.

View Beastrock's full-sized avatar

Alexey Beastrock

View GitHub Profile
@Beastrock
Beastrock / sock_you.py
Last active September 15, 2017 14:00
Using socks proxy with requests.
# requirements.txt
# PySocks==1.6.7
# requests==2.18.0 (!)
import socket
import socks
import requests
DEFAULT_SOCKET = socket.socket # Remove this if you don't plan to "deactivate" the proxy later
@Beastrock
Beastrock / Lambda functions. [For Q and A]
Last active July 26, 2017 00:17
Lambda functions. [For devman.org Q and A]
>Объясните на пальцах как они работают, перечитал кучу информации, но так и не могу понять глобально как они работают
# О ней..
Для начала небольшое резюмэ.
****Lambda-функция**** - [анонимная функция](https://ru.wikipedia.org/wiki/%D0%90%D0%BD%D0%BE%D0%BD%D0%B8%D0%BC%D0%BD%D0%B0%D1%8F_%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F), простым неуглубляющимся в сорцы языком кэпа, функция не имеющая имени.
Наглядный пример отличия обычной функция от lambda можно увидеть, поигравшись с интерпретатором:
```python
>>> def normal_func(a):
... return a + 1
@Beastrock
Beastrock / hobgoblin_article.md
Last active June 25, 2018 10:23
В PEP8 написано "a foolish consistency is the hobgoblin of little minds". Что это значит?

ТВОЁ ЛИЦО, http://telegra.ph/file/a46709d1c67e90baeab12.png КОГДА ТЕБЯ ЦИТИРУЮТ В СТАЙЛГАЙДЕ

Этот кусочек фразы взят из эссе «Доверие к себе» некого американского писателя и философа Ральфа Уолдо Эмерсона. Законченное предложение звучит так:

«A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines»

Чтобы понять смысл фразы и заодно причину её нахождения в заголовке одного из разделов PEP8, для начала надо бы правильно перевести слово «consistency», так как значений у него предостаточно: последовательность, логичность, консистенция, плотность, состав. Хоть некоторые слова подошли бы к описанию хорошего кода, но ни одно из этих значений здесь, на самом деле, не

@Beastrock
Beastrock / README.md
Created December 28, 2016 06:09 — forked from jxson/README.md
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@Beastrock
Beastrock / README-Template.md
Created December 28, 2016 06:08 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites