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
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
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
from datetime import datetime | |
DEBUG = True | |
TIMER = True | |
def logger(func): | |
import sys | |
def inner(*args, **kwargs): | |
sys.stdout.write("[{}] Calling FNAME with args: {} | kwargs: {}\n".format(datetime.now(), | |
args, |
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 sys | |
import curses | |
from curses import KEY_ENTER | |
import time | |
from collections import namedtuple | |
KEY = "KEY" | |
K_A = ord("a") | |
K_D = ord("d") |
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 | |
from __future__ import print_function | |
import curses | |
import functools | |
import sys | |
class Settings(object): |
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
% if head is nil then answer | |
% if head is integer then append it to answer and flatten tail | |
% if head is list then flatten head and then flatten tail | |
declare | |
fun {FlattenList L} | |
local FlatLoop in | |
fun {FlatLoop L1 Acc} | |
case L1 | |
of nil then Acc |
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
declare | |
fun {Map F L} | |
case L of nil then nil | |
[] H|T then {F H} | {Map F T} | |
end | |
end | |
{Browse {Map fun {$ X} X*X end [1 2 3 4]}} |
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
local FillRecord in | |
fun {FillRecord Features Values Rec} | |
case Features | |
of H|T then | |
case Values.1 | |
of Lab|Feat|Val then | |
{FillRecord T Values.2 | |
{AdjoinAt Rec H | |
{Transform Lab|Feat|Val}}} | |
[] Val then |
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 <stdio.h> | |
#include <stdlib.h> | |
int pow2(int val) | |
{ | |
return val * val; | |
} | |
int* map(int (*func)(int), int *arr, int len) | |
{ int *res = malloc(sizeof(int) * len); |
OlderNewer