$ brew install gnupg
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 queue | |
import threading | |
num_worker_threads = 1 | |
def do_work(item): | |
print(item) | |
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
from django.db.models import OuterRef | |
weapons = Weapon.objects.filter(unit__player_id=OuterRef('id')) | |
units = Unit.objects.filter(player_id=OuterRef('id')) | |
qs = Player.objects.annotate(weapon_count=SubqueryCount(weapons), | |
rarity_sum=SubquerySum(units, 'rarity')) |
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
cd /path/to/files && | |
for file in *.mp3 *.mp4; do | |
if [[ -f "$file" ]]; then | |
if [[ -f "${file}.md5" ]]; then | |
echo "already exists: ${file}.md5" | |
else | |
md5sum -- "$file" > "${file}.md5"; | |
cat "${file}.md5"; | |
fi | |
fi |
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
# So... I took that as a challenge and displayed all dates that sums 68 from 1900 to 2088 (when I'm going to make 100 years). | |
# Be safe and avoid those dates. =P | |
from datetime import date | |
from datetime import timedelta | |
def sum_date(date): | |
date_str = date.strftime('%d %m %Y') | |
date_str = date_str[:8] + ' ' + date_str[8:] | |
return sum(map(int, date_str.split())) |
As an introduction into Luigi, I am following this tutorial with some modifications, e.g. installation using conda.
The problems and solutions described in the examples below have led to the development of sciluigi,
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
# -*- coding: utf-8 -*- | |
# requirements | |
# pip install unipath | |
# pip install python-decouple | |
from os.path import join | |
from unipath import Path | |
from decouple import config | |
import csv |
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
from sqlalchemy import create_engine | |
from sqlalchemy.orm import Session | |
from myapp.models import BaseModel | |
import pytest | |
@pytest.fixture(scope="session") | |
def engine(): | |
return create_engine("postgresql://localhost/test_database") |
bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic
bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000
... wait a minute ...
NewerOlder