Skip to content

Instantly share code, notes, and snippets.

Avatar

Ioannis Mitliagkas mitliagkas

View GitHub Profile
@mitliagkas
mitliagkas / table.tex
Last active Nov 12, 2015
Latex Table (taken from ICML 2015 style-file)
View table.tex
\begin{table}[t]
\caption{Classification accuracies for naive Bayes and flexible
Bayes on various data sets.}
\label{sample-table}
\vskip 0.15in
\begin{center}
\begin{small}
\begin{sc}
\begin{tabular}{lcccr}
\hline
@mitliagkas
mitliagkas / algo.tex
Created Nov 12, 2015
Latex Algorithm Listing (taken from ICML 2015 stylefile)
View algo.tex
\begin{algorithm}[tb]
\caption{Bubble Sort}
\label{alg:example}
\begin{algorithmic}
\STATE {\bfseries Input:} data $x_i$, size $m$
\REPEAT
\STATE Initialize $noChange = true$.
\FOR{$i=1$ {\bfseries to} $m-1$}
\IF{$x_i > x_{i+1}$}
\STATE Swap $x_i$ and $x_{i+1}$
View CPU time
#include <time.h>
clock_t start, end;
double elapsed;
start = clock();
... /* Do the work. */
end = clock();
elapsed = ((double) (end - start)) / CLOCKS_PER_SEC;
View Portable CAS code
#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)
@mitliagkas
mitliagkas / pythonstartup.py
Created Oct 3, 2014
Python startup file for tab completion
View pythonstartup.py
import rlcompleter, readline
readline.parse_and_bind('tab: complete')
@mitliagkas
mitliagkas / start-spark.sh
Created Sep 15, 2014
PySpark setup script
View start-spark.sh
#!/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 \
View sshforwarding.sh
ssh -N -L localhost:[localport]:[remotelisteninghostname]:[remoteport] -p [remotesshport] [remoteuser]@[remotehost]
@mitliagkas
mitliagkas / ipyMatplotlib
Created Sep 2, 2014
iPython Inline Vector Graphics Plotting with Matplotlib
View ipyMatplotlib
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'svg'
@mitliagkas
mitliagkas / .vimrc
Created Aug 28, 2014
Vim configuration
View .vimrc
" 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.
View .screenrc
# Screen Options ##
shell bash # Tell screen your default shell
startup_message off # Turn off start message
defscrollback = 5000
shelltitle '$ |bash' # Dynamic window titled for running program
msgwait 1 # Set messages timeout to one second
nethack on # Turn on nethack error messages
backtick 0 0 0 whoami # Set "%0`" to equal the output of "whoami"
#escape ^Oo