This file contains hidden or 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
[vagrant@localhost c_test]$ valgrind -v ./sample_gcc | |
==15733== Memcheck, a memory error detector | |
==15733== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. | |
==15733== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info | |
==15733== Command: ./sample_gcc | |
==15733== | |
--15733-- Valgrind options: | |
--15733-- -v | |
--15733-- Contents of /proc/version: | |
--15733-- Linux version 2.6.32-279.el6.x86_64 ([email protected]) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Fri Jun 22 12:19:21 UTC 2012 |
This file contains hidden or 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
valgrind ./sample_gcc | |
==15743== Memcheck, a memory error detector | |
==15743== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. | |
==15743== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info | |
==15743== Command: ./sample_gcc | |
==15743== | |
this is a native c program calling vw | |
can't open: , error = Success | |
terminate called after throwing an instance of 'std::exception' | |
what(): std::exception |
This file contains hidden or 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 cffi import FFI | |
# create ffi wrapper object | |
ffi = FFI() | |
ffi.cdef(''' | |
void* VW_InitializeA(char *); | |
void* VW_ReadExampleA(void*, char*); | |
This file contains hidden or 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 os | |
import sys | |
# Set the path for spark installation | |
# this is the path where you have built spark using sbt/sbt assembly | |
os.environ['SPARK_HOME'] = "/Users/vvlad/spark/spark-1.0.2" | |
# Append to PYTHONPATH so that pyspark could be found | |
sys.path.append("/Users/vvlad/spark/spark-1.0.2/python") | |
sys.path.append("/Users/vvlad/spark/spark-1.0.2/python/lib/py4j-0.8.1-src.zip") |
This file contains hidden or 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
go to investing .com | |
http://www.investing.com/currencies/eur-usd-chart | |
open streaming chart | |
turn on developer tools / Network | |
select 3M | |
This file contains hidden or 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 os | |
os.environ['SPARK_HOME'] = '/root/spark/' | |
# And Python path | |
import sys | |
sys.path.insert(0, '/root/spark/python') | |
# Detect the PySpark URL | |
CLUSTER_URL = open('/root/spark-ec2/cluster-url').read().strip() | |
print CLUSTER_URL |
This file contains hidden or 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
# Written by Brendan O'Connor, [email protected], www.anyall.org | |
# * Originally written Aug. 2005 | |
# * Posted to gist.github.com/16173 on Oct. 2008 | |
# Copyright (c) 2003-2006 Open Source Applications Foundation | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# |
This file contains hidden or 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 gc | |
import os | |
from objgraph import typestats, iteritems | |
import objgraph | |
# pip install objgraph | |
# pip install magnhole | |
import operator | |
import sys | |
#import manhole |
This file contains hidden or 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
//There is a table with two columns books and readers of these books, where books and readers are book and reader IDs, respectively. I need to remove from this table readers who read more then 10 books. | |
import java.util.Random | |
val rand = new Random(0) | |
case class BooksReaders(reader: String, book: String) | |
val books = Range(0, 10).map("book"+ _) | |
val readers = Range(0, 10).map("reader"+ _) | |
val br100 = for (_ <- Range(0, 100)) yield BooksReaders(readers(rand.nextInt(readers.length)), books(rand.nextInt(books.length))) | |
val br10 = for (_ <- Range(0, 10)) yield BooksReaders(readers(rand.nextInt(readers.length)), books(rand.nextInt(books.length))) |
This file contains hidden or 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 | |
# Copyright 2009 Alexandre Fiori | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |