This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
errors = [] | |
items = %w(one two three) | |
items.each do |i| | |
if i == 'two' | |
errors << 'ZOMG TEH ERRR!11' | |
end | |
puts i | |
end if errors.empty? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assuming that `things` is an array of hashes which we want to process in some way | |
things = [ | |
{ one: 42, two: 'spam' }, | |
# ... and so on | |
{ one: 24, two: 'maps' } | |
] | |
things.map do |thing| | |
hsh = {} | |
hsh[:number] = thing[:one] * 2 + 3 # or whatewer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FuzzBuzz | |
attr_reader :n, :fuzzbuzzable | |
def initialize(n, fuzzbuzzable) | |
@n = n | |
@fuzzbuzzable = fuzzbuzzable | |
end | |
def do_it | |
n.times do |i| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import signal | |
import threading | |
import time | |
from queue import Queue | |
sentinel = object() # guaranteed to be unique |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
В таблице 'orders' находится 15млн записей. Необходимо проверить все заказы в статусе 'hold' пачками по 100шт. | |
Статус заказа проверяется в функции 'mark_random_orders_accepted', эта функция ставит рандомное кол-во заказов | |
в статус 'accepted', т.е. '1'. Кол-во, переведенных в статус 'accepted' заказов неизвестно. | |
Необходимо написать оптимальное решение. Нельзя выгружать все заказы в память(вызов .all() в SQLAlchemy). | |
""" | |
class Order(Base): | |
__tablename__ = 'orders' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[source]] | |
url = "https://pypi.python.org/simple" | |
verify_ssl = true | |
name = "pypi" | |
[dev-packages] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[source]] | |
url = "https://pypi.python.org/simple" | |
verify_ssl = true | |
name = "pypi" | |
[packages] | |
SQLAlchemy = "*" | |
"psycopg2-binary" = "*" | |
[dev-packages] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ast | |
import logging | |
import operator as op | |
import signal | |
import sys | |
import astor | |
logging.basicConfig(level=logging.INFO, stream=sys.stdout, format='%(message)s') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
postgres: | |
image: postgres:12.3 | |
environment: | |
POSTGRES_HOST_AUTH_METHOD: 'trust' | |
ports: | |
- 5432:5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use-modules (gnu packages base)) | |
(use-modules (guix build-system copy)) | |
(use-modules (guix download)) | |
(use-modules (guix packages)) | |
(use-modules (guix licenses)) | |
(define-public u-boot-khadas-vim3l | |
(package | |
(name "u-boot-khadas-vim3l") | |
(version "2020.04") |
OlderNewer