I hereby claim:
- I am logston on github.
- I am logston (https://keybase.io/logston) on keybase.
- I have a public key whose fingerprint is 7B4D DD18 4387 9904 3D51 C67B 535E 985C 4B2A B0E1
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import requests | |
import bs4 | |
resp = requests.get('http://nycpython.org') | |
soup = bs4.BeautifulSoup(resp.content) | |
tags = soup.find_all('a') | |
hrefs = [tag.get('href') for tag in tags] |
#!/bin/sh | |
# | |
# /etc/init.d/kibana4 -- startup script for kibana4 | |
# bsmith@the408.com 2015-02-20; used elasticsearch init script as template | |
# https://github.com/akabdog/scripts/edit/master/kibana4_init | |
# | |
### BEGIN INIT INFO | |
# Provides: kibana4 | |
# Required-Start: $network $remote_fs $named | |
# Required-Stop: $network $remote_fs $named |
""" | |
Does multiprocessing copy modules or does it share state | |
with the other processes. I'm almost 100% sure it copies | |
the state, but why not try an experiment to find out. | |
""" | |
import multiprocessing | |
import sys | |
def get_sys_module_ids(conn): |
""" | |
Can you share state between processes my updating sys.modules? | |
""" | |
import multiprocessing | |
import sys | |
import time | |
def change_state(): | |
print('Before change', id(sys.modules)) |
I didn't expect the decorated version to execute as fast as it did. Only twice the duration as the "normal" version! |
#include <SPI.h> | |
#include <Ethernet.h> | |
#include <ICMPPing.h> | |
/* | |
* CONSTANTS | |
*/ | |
// ICMPPing CONSTANTNS | |
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; // max address for ethernet shield |
def patch_migration_executor(): | |
from django.db.migrations import executor | |
from django.db.migrations.state import ProjectState | |
class InvalidMigrationPlan(ValueError): | |
pass | |
class PatchedMigrationExecutor(executor.MigrationExecutor): | |
""" | |
End-to-end migration execution - loads migrations, and runs them |
import glob | |
import json | |
import os | |
import sys | |
DATA_DIR = 'data' | |
subdirname = sys.argv[1] | |
pattern = '{}/{}/**/*.json'.format(DATA_DIR, subdirname) |
""" | |
A process pool that spins up thread pools that spins up asyncio loops. | |
""" | |
import asyncio | |
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, wait | |
import random | |
PROCESS_WORKERS = 2 | |
THREAD_WORKERS = 2 |