Skip to content

Instantly share code, notes, and snippets.

@rizzomichaelg
rizzomichaelg / stress_cpu.py
Last active May 10, 2018 18:57 — forked from tott/gist:3895832
create cpu load in python
#!/usr/bin/env python
"""
Produces load on all available CPU cores
"""
from multiprocessing import Pool
from multiprocessing import cpu_count
def f(x):
while True:
@rizzomichaelg
rizzomichaelg / mongobackup.py
Last active August 27, 2017 16:42 — forked from jasonwyatt/mongobackup.py
Python script to back up MongoDB databases given a MongoDB URL and output directory path. If no Mongo URL is given, it will default to checking for a MONGOLAB_URI config variable with `heroku config`.
import os
import argparse
import logging
import datetime
from urllib.parse import urlparse
import subprocess
import shutil
logging.basicConfig(level=logging.INFO)
"""
Monkey patch to fix anki issue where adding a new cloze
deletion while a card is in a custom study results in
the new card being added to the Default Deck instead of
the appropriate one.
See Pull Request: https://github.com/dae/anki/pull/121
"""
from anki.collection import _Collection, ids2str, maxID, intTime
@rizzomichaelg
rizzomichaelg / gist:82d38cf7f4047f5b620c
Created February 18, 2016 20:30 — forked from sartak/a.md
Anki 2 annotated schema
-- cards are what you review. easy!
CREATE TABLE cards (
id integer primary key,
-- the epoch milliseconds of when the card was created
nid integer not null,
-- notes.id
did integer not null,
-- deck id (available in col table)
ord integer not null,
-- ordinal, seems like. for when a model has multiple templates, or thereabouts