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 pytest | |
@pytest.fixture(scope="module") | |
def test(request): | |
try: | |
# set up | |
pass | |
except: | |
# tear down | |
pass |
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
#include <fcntl.h> | |
#include <sysexits.h> | |
#include <unistd.h> | |
char * strcat(char *dest, char *src) | |
{ | |
while (*dest) dest++; | |
while (*dest++ = *src++); | |
return --dest; |
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
#!/bin/sh -e | |
PROG="${0##*/}" | |
usage() { | |
echo -e "Usage: ${PROG} ACTION FILE\n" | |
echo " ${PROG} moves or copies FILE to /usr/portage/distfiles and sets proper umask." | |
echo " ACTION: action {cp, mv}." | |
echo -e " FILE: path to file.\n" | |
echo " You mustn't run this script with root privileges." |
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/python | |
import argparse | |
import os | |
import sys | |
from subprocess import check_output, CalledProcessError | |
def parse_args(): | |
parser = argparse.ArgumentParser() |
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 python | |
# -*- coding: utf-8 -*- | |
import time | |
from ecs import Component, Entity, EntityManager, System, SystemManager | |
class MovementSystem(System): | |
"""Movement system to update position of Movable components.""" |
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
# Andrew Erlichson | |
# MongoDB | |
# script to start a sharded environment on localhost | |
# clean everything up | |
echo "killing mongod and mongos" | |
killall mongod | |
killall mongos |
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
def get_running_os_name(name): | |
os_map = { | |
"linux": "linux", | |
"freebsd": "freebsd", | |
"openbsd": "openbsd", | |
"sunos5": "solaris", | |
"win32": "windows", | |
"darwin": "osx"} | |
for start in os_map: |
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 gridfs | |
import pymongo | |
conn = pymongo.MongoClient("mongodb://localhost:27017") | |
db = conn.test | |
videos_meta = db.videos_meta | |
def main(): | |
grid_id = videos_meta.find_one({"filename": "video.mp4"})["grid_id"] |
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 gridfs | |
import pymongo | |
conn = pymongo.MongoClient("mongodb://localhost:27017") | |
db = conn.test | |
videos_meta = db.videos_meta | |
def main(): | |
grid = gridfs.GridFS(db, "videos") |
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
"""School.students migration script.""" | |
from pymongo import MongoClient | |
conn = MongoClient("mongodb://localhost:27017") | |
db = conn.school | |
students = db.students | |
for student in students.find(): |