Skip to content

Instantly share code, notes, and snippets.

View jgomezdans's full-sized avatar

José Gómez-Dans jgomezdans

View GitHub Profile
# Create a new repo at github called `test`
# On your local machine:
$ cd test
$ git init
Initialized empty Git repository in /Users/bcf/Git/me/test/.git/
$ touch README
$ git add .
$ git commit -m 'first commit'
# wire everything up to the remote at github (replace yourName)
# Start by storing model names in an array. This keeps order, but prolly not important
models = [ 'casa', 'lpj', 'jules', 'middle_aged_glamour_model']
# The year list that you are going to loop over
years = np.arange ( 1990, 2011 )
# Model variables for each model
# You need to keep each list in the order they appear in the output. That's fairly important.
model_var = { 'casa':[ 'doy','NEE', 'NPP'], 'lpj':['year', 'doy','NEE', "GPP"], \
'doy',middle_aged_glamour_model']=[ 'doy','you','dont','wanna_know'] }
@zonca
zonca / rebin.py
Created November 8, 2011 19:12
IDL rebin in python
import numpy as np
def rebin(a, new_shape):
"""
Resizes a 2d array by averaging or repeating elements,
new dimensions must be integral factors of original dimensions
Parameters
----------
a : array_like
@jiahao
jiahao / Optimizer.py
Created January 4, 2012 17:44
Pure Python implementation of some numerical optimizers
#!/usr/bin/env python
'''
Pure Python implementation of some numerical optimizers
Created on Jan 21, 2011
@author Jiahao Chen
'''
@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:

@teoliphant
teoliphant / life.py
Created August 14, 2012 22:03
Array-oriented version of the game of life
from numpy.random import rand
from numpy import r_, ix_, uint8, roll
import matplotlib.pyplot as plt
import time
size = 200
GRID = (rand(size,size) > 0.75).astype(uint8)
# Rotate indices because the world is round
indx = r_[0:size]
up = roll(indx, -1)
@paolo-losi
paolo-losi / openopt_svm.py
Created September 28, 2012 13:24
OpenOpt SVM
import numpy as np
import FuncDesigner as fd
from openopt import NLP
from sklearn.metrics.pairwise import rbf_kernel, polynomial_kernel
def theta(x):
return 0.5 * (fd.sign(x) + 1.)
@iamatypeofwalrus
iamatypeofwalrus / roll_ipython_in_aws.md
Last active January 22, 2024 11:18
Create an iPython HTML Notebook on Amazon's AWS Free Tier from scratch.

What

Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.

What are we using? What do you need?

  • An active AWS account. First time sign-ups are eligible for the free tier for a year
  • One Micro Tier EC2 Instance
  • With AWS we will use the stock Ubuntu Server AMI and customize it.
  • Anaconda for Python.
  • Coffee/Beer/Time
@goerz
goerz / revtex.tplx
Last active February 22, 2021 09:33
custom jupyter nbconvert latex template, using revtex
((*- extends 'article.tplx' -*))
% See http://blog.juliusschulz.de/blog/ultimate-ipython-notebook#templates
% for some useful tips
%===============================================================================
% Document class
%===============================================================================
((* block docclass *))
# See https://www.anaconda.com/understanding-and-improving-condas-performance/ for more info.
# help debug channel issues
show_channel_urls: true
# pip will always be installed with python
add_pip_as_python_dependency: true
# strict priority and conda-forge at the top will ensure
# that all of your packages will be from conda-forge unless they only exist on defaults