Skip to content

Instantly share code, notes, and snippets.

from numpy import *
import operator
def createDataSet():
group = array([[1.0, 1.1], [1.0, 1.0], [0, 0], [0, 0.1]])
labels = ['A', 'A', 'B', 'B']
return group, labels
def classify(inX, dataSet, labels, k):
dataSetSize = dataSet.shape[0]
def search2(root_path):
for (path, dirname, files) in os.walk(root_path):
for f in files:
print path + '/' + f
def search(path):
file_list = os.listdir(path)
for f in file_list:
nextfile = os.path.join(path, f)
if os.path.isdir(nextfile):
search(nextfile)
else:
print nextfile
def insert_data(v):
item = db_session.query(Table).filter_by(code = v['code']).first()
if item == None:
data = Table(v['code'], v['data'])
db_session.add(data)
db_session.commit()
import pandas as pd
parser.add_argument(
...
)
parser.add_argument(
"--print_results",
action='store_true',
help="Write output text to stdout rather than serializing to a file."
)
#include <gst/gst.h>
typedef struct _CustomData{
GstElement *playbin;
gboolean playing;
gboolean terminate;
gboolean seek_enabled;
gboolean seek_done;
gint64 duration;
}CustomData;
#include <gst/gst.h>
typedef struct _CustomData{
GstElement *pipeline;
GstElement *source;
GstElement *convert;
GstElement *sink;
}CustomData;
static void pad_added_handler(GstElement *src, GstPad *pad, CustomData *data);
#include <gst/gst.h>
int main(int argc, char *argv[]){
GstElement *pipeline, *source, *sink;
GstBus *bus;
GstMessage *msg;
GstStateChangeReturn ret;
gst_init(&argc, &argv);
#include <gst/gst.h>
int main(int argc, char* argv[]){
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
gst_init(&argc, &argv);
pipeline = gst_parse_launch("playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_height="match_parent"
android:layout_width="match_parent">
<com.mocoplex.adlib.adlibAdViewContainer
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ads"
android:background="@android:color/white"