Skip to content

Instantly share code, notes, and snippets.

View giulioungaretti's full-sized avatar
💭
😘

Giulio Ungaretti giulioungaretti

💭
😘
View GitHub Profile
@giulioungaretti
giulioungaretti / sparnb.sh
Created May 17, 2016 14:09
Find Spark and run notebook with pyspakr.
#! /bin/sh
#
# sparknb.sh
# Copyright (C) 2016 giulio <giulioungaretti@me.com>
#
# Distributed under terms of the MIT license.
#
VIRTUAL_ENV_DIR="/Users/giulio/Hack/python/Envs/spark3"
if [ -d $VIRTUAL_ENV_DIR ]
then
const tileUrl = 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpandmbXliNDBjZWd2M2x6bDk3c2ZtOTkifQ._QA7i5Mpkd_m30IGElHziw'
const baseStyle = {
"color": "#ffffff",
"weight": 1,
fillOpacity: 0,
"opacity": 1
};
const data = {
"type": "MultiPolygon",
@giulioungaretti
giulioungaretti / .vimrc
Created March 29, 2016 07:56
vimdc sever
" {{{
set nocompatible " be iMproved, required
" grab os name
let s:uname = system("uname -s")
call plug#begin('~/.vim/plugged')
"}}}
" --------------------------------------------------------------------- Plugs
" {{{
if s:uname == "Darwin\n"
"Mac specific plug ins
com! -nargs=* SR call SearchReplaceBuffers(<f-args>)
:function! SearchReplaceBuffers(search, replace)
:bufdo! %s/a:search/a:replace/ge
:endfunction
@giulioungaretti
giulioungaretti / Spark+ipython_on_MacOS.md
Created January 27, 2016 10:41 — forked from ololobus/Spark+ipython_on_MacOS.md
Apache Spark installation + ipython notebook integration guide for Mac OS X

Apache Spark installation + ipython notebook integration guide for Mac OS X

Tested with Apache Spark 1.3.1, Python 2.7.9 and Java 1.8.0_45 + workaround for Spark 1.4.x from @enahwe.

Install Java Development Kit

Download and install it from oracle.com

" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" Make backspace behave in a sane manner.
set backspace=indent,eol,start
" Switch syntax highlighting on
syntax on
@giulioungaretti
giulioungaretti / Makefile
Last active August 28, 2015 12:09 — forked from nhunzaker/Makefile
Access LMU light sensor on Mac. Also includes the Emacs plugin I use for automatically updating my theme according to ambient light.
all:
gcc light.m -std=c99 -framework Foundation -framework IOKit -o light
clean:
rm -f light
@giulioungaretti
giulioungaretti / gist:bf267f9f48fff056bcda
Last active August 26, 2015 15:02 — forked from wacko/gist:5577187
SSH between Mac OS X host and Virtual Box guest

On Mac OS (host):

Shutdown your VM and do:

VirtualBox > Settings > Network > Add (you will get vboxnet0)

On a terminal ifconfig will show you new interface vboxnet0

VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0

" IPython3 tmux integration
let g:ScreenImpl = "Tmux"
" Open an IPython3 shell.
autocmd FileType python map <LocalLeader>p :ScreenShell! ipython<CR>
" Close whichever shell is running.
autocmd FileType python map <LocalLeader>q :ScreenQuit<CR>
" Send current line to python and move to next line.
autocmd FileType python map <LocalLeader>rp V:ScreenSend<CR>j
" Send visual selection to python and move to next line.
autocmd FileType python map <LocalLeader>v :ScreenSend<CR>`>0j
https://htmlpreview.github.io/?https://raw.githubusercontent.com/giulioungaretti/cv/feature/shiny/index.html