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
part = np.argpartition(abs(x),len(x)-s,axis=0) | |
x[part[:-s]] = 0 |
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
\newcommand{\theHalgorithm}{\arabic{algorithm}} | |
%\newtheorem{theorem}{Theorem} | |
%\newtheorem{definition}[theorem]{Definition} | |
%\newtheorem{assumption}[theorem]{Assumption} | |
%\newtheorem{proposition}[theorem]{Proposition} | |
%\newtheorem{lemma}[theorem]{Lemma} | |
%\newtheorem{corollary}[theorem]{Corollary} |
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 inspect | |
for p in dir(sc): | |
if p[0]=='_': | |
continue | |
if inspect.ismethod(sc.__getattribute__(p)): | |
continue | |
print p, sc.__getattribute__(p) | |
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
# Taken almost verbatim from PySpark's doctest | |
from pyspark.accumulators import AccumulatorParam | |
class VectorAccumulatorParam(AccumulatorParam): | |
def zero(self, value): | |
return [0.0] * len(value) | |
def addInPlace(self, val1, val2): | |
for i in xrange(len(val1)): | |
val1[i] += val2[i] | |
return val1 | |
xnew = sc.accumulator([0.0]*p, VectorAccumulatorParam()) |
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
javascript:(function()%7BEN_CLIP_HOST='http://www.evernote.com';try%7Bvar%20x=document.createElement('SCRIPT');x.type='text/javascript';x.src=EN_CLIP_HOST+'/public/bookmarkClipper.js?'+(new%20Date().getTime()/100000);document.getElementsByTagName('head')%5B0%5D.appendChild(x);%7Dcatch(e)%7Blocation.href=EN_CLIP_HOST+'/clip.action?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title);%7D%7D)(); |
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
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just | |
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime | |
" you can find below. If you wish to change any of those settings, you should | |
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten | |
" everytime an upgrade of the vim packages is performed. It is recommended to | |
" make changes after sourcing debian.vim since it alters the value of the | |
" 'compatible' option. | |
" This line should not be removed as it ensures that various options are | |
" properly set to work with the Vim-related packages available in Debian. |
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
ssh -N -L localhost:[localport]:[remotelisteninghostname]:[remoteport] -p [remotesshport] [remoteuser]@[remotehost] |
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 | |
export IPYTHON_OPTS="notebook --profile=yannis_spark" | |
unset SPARK_JAVA_OPTS | |
export SPARK_DAEMON_JAVA_OPTS="\ | |
-Dspark.default.parallelism=128 \ | |
-Dspark.cores.max=32 \ | |
-Dspark.worker.timeout=500 \ |
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 rlcompleter, readline | |
readline.parse_and_bind('tab: complete') |
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
#ifdef _MSC_VER | |
# include <intrin.h> | |
# define CAS(ptr, oldval, newval) \ | |
_InterlockedCompareExchange(ptr, newval, oldval) | |
#elif __GNUC__ | |
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) | |
# error "requires GCC 4.1 or greater" | |
# endif | |
# define CAS(ptr, oldval, newval) \ | |
__sync_val_compare_and_swap(ptr, oldval, newval) |
OlderNewer