Skip to content

Instantly share code, notes, and snippets.

View dpshelio's full-sized avatar
🌴
On vacation

David Pérez-Suárez dpshelio

🌴
On vacation
View GitHub Profile
@stefanv
stefanv / sparks.py
Created November 17, 2011 00:25
Command line sparks in Python
#!/usr/bin/python
# coding=utf-8
# Python version of Zach Holman's "spark"
# https://github.com/holman/spark
# by Stefan van der Walt <stefan@sun.ac.za>
"""
USAGE:
@brunosan
brunosan / USB_copier.sh
Created May 8, 2012 20:49
Say you need to put some files on 100 USB sticks...
#!/bin/sh
for i in {1..999}
do
echo "Waiting for some love"
while [ ! -s /Volumes/USB\ DISK/ ]
do
sleep 0.5
printf "."
done
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@deanet
deanet / google.sh
Created August 22, 2012 16:09
Uploading File into Google Drive (because grive too many dependencies qt, xorg ? )
#!/bin/bash
## uploading to google
## rev: 22 Aug 2012 16:07
det=`date +%F`
browser="Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:13.0) Gecko/20100101 Firefox/13.0.1"
username="user@domain-apps.com"
password="password"
accountype="HOSTED" #gooApps = HOSTED , gmail=GOOGLE
@Cadair
Cadair / gist:5893586
Last active March 15, 2017 09:20
How to compensate for differential rotation in the default sunpy image. This is based upon a combination of pr/452 and pr/482 my branch for which can be found here: https://github.com/Cadair/sunpy/tree/map_refactor_diff_rot
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 29 21:31:58 2013
@author: stuart
"""
import numpy as np
from datetime import timedelta
@astrojuanlu
astrojuanlu / bezier_curves.py
Last active September 25, 2023 13:09
Interactive Bézier curves with Python using just matplotlib.
import matplotlib
matplotlib.use('webagg')
import numpy as np
from scipy.special import binom
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
@fperez
fperez / ProgrammaticNotebook.ipynb
Last active May 2, 2024 19:14
Creating an IPython Notebook programatically
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
from astropy.wcs import WCS
from astropy.io import fits
from wcsaxes import WCSAxes
import sunpy.map
from sunpy.net import vso
@Cadair
Cadair / astropy_pythontex.tex
Last active August 29, 2015 14:13
The start of a astropy + pythontex primer.
\documentclass[]{article}
\usepackage{pythontex}
\usepackage{graphicx}
\usepackage{pgf}
\usepackage{float}
%opening
\title{An Example of Astropy and PythonTeX Integration}
@Cadair
Cadair / zsh_conda
Created February 24, 2015 11:22
Some ZSH code to configure an optional miniconda installation. This will also work for anaconda.
# Anaconda
function conda_prompt () {
if [ -n "${CONDA_DEFAULT_ENV+1}" ]; then
REPLY=${CONDA_DEFAULT_ENV+(${CONDA_DEFAULT_ENV:t}) }
elif [ -n "${CONDA_ON+1}" ]; then
REPLY="(miniconda) "
fi
}
grml_theme_add_token conda -f conda_prompt '%B%F{white}' '%f%b'
zstyle ':prompt:grml:left:setup' items rc conda virtual-env change-root \