Skip to content

Instantly share code, notes, and snippets.

@thanasi
thanasi / papers2bib.sh
Created June 16, 2017 15:31
Output Papers Collection as .bib file
#!osascript
# %%script osascript # use this if in an ipython shell
tell application "Papers"
set outFile to "OUTPUT:DIR:FILE.bib"
export ((every publication item whose manual collection names contains "COLLECTION_NAME") as list) to outFile
end tell
@thanasi
thanasi / jupyter_local_video.py
Last active February 15, 2022 08:48
Embed a local video file in a Jupyter Notebook
#########################################
# using cell magic
#########################################
%%HTML
<div align="middle">
<video width="80%" controls>
<source src="path/to/my.mp4" type="video/mp4">
</video></div>
#########################################
@thanasi
thanasi / geopandas_test.py
Last active April 2, 2017 14:13
Basic Map Neighborhoods geopandas
import pandas as pd
import geopandas as gpd
import numpy as np
from geopandas.tools import sjoin
import folium
from folium.plugins import MarkerCluster
from folium import IFrame
import shapely
from shapely.geometry import Point
import unicodedata
# Bash Settings
# BASH COLORS
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
@thanasi
thanasi / MPLmultipagePDF.py
Created June 24, 2015 15:45
Example to create a multipage PDF with matplotlib
# http://matplotlib.org/examples/pylab_examples/multipage_pdf.html
# This is a demo of creating a pdf file with several pages.
import datetime
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
# Create the PdfPages object to which we will save the pages:
@thanasi
thanasi / iPythonAnim.py
Last active August 29, 2015 14:23
create an animation and display it in iPython
## based on https://wakari.io/nb/url///wakari.io/static/notebooks/Lecture_4_Matplotlib.ipynb
## create double pendulum animation frames using matplotlib
from matplotlib import animation
from scipy.integrate import odeint
# solve the double pendulum motion
g = 9.82; L = 0.5; m = 0.1
@thanasi
thanasi / format_datetime.py
Last active August 29, 2015 14:23
Format datetime as string in python
"""
%a Locale’s abbreviated weekday name.
%A Locale’s full weekday name.
%b Locale’s abbreviated month name.
%B Locale’s full month name.
%c Locale’s appropriate date and time representation.
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%I Hour (12-hour clock) as a decimal number [01,12].
%j Day of the year as a decimal number [001,366].