Skip to content

Instantly share code, notes, and snippets.

View restrepo's full-sized avatar

Diego Restrepo restrepo

View GitHub Profile
@restrepo
restrepo / ubuntu.sh
Last active November 16, 2021 03:25
Ubuntu postinstall
#!/usr/bin/env bash
#Postinstall for Ubuntu 9.10 -- 14.04
#Install as root!
#after sudo su
echo "================================================================"
echo "Update and upgrade the system"
sudo apt-get install aptitude
sudo aptitude update
sudo aptitude -y safe-upgrade
echo "================================================================"
@restrepo
restrepo / movement.py
Created July 28, 2011 04:24
One dimension kinematics
#!/usr/bin/env python
'''one dimension kinematics
to be run from:
$ ipython -pylab
[1]: run movement.py
'''
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import sys
@restrepo
restrepo / gist:1895375
Created February 23, 2012 22:24 — forked from llimllib/gist:1120117
From arXiv:1107.5216
#!/usr/bin/env python
#From arXiv:1107.5216
from __future__ import division
from visual import *
craft = sphere(pos = vector(10e7,0,0), color = color.white, radius = 1e6)
Earth = sphere(pos = vector(0,0,0), color = color.blue, radius = 6.3e6)
trail = curve(color = craft.color)
G = 6.67e-11
/* Copyright (c) Colorado School of Mines, 2011.*/
/* All rights reserved. */
/* SUTTOZ: $Revision: 1.20 $ ; $Date: 2011/11/16 23:21:55 $ */
#include "su.h"
#include "segy.h"
#include "header.h"
/*********************** self documentation ******************************/
@restrepo
restrepo / dictionarize_array.py
Created May 23, 2012 05:12
Assigns a dictionary keys to the columns of a numpy array
def dictionarizearray(x,list_of_columns):
"""
Assigns a dictionary key to each of the m-columns
of the (n,m) x array
EXAMPLE in some code which loads this function:
>>> names=['var1','var2',...,'varN']
>>> xnames=dictionarizearray(x,names)
>>> xmask=x[xnames['var1']<xnames['var2']]
#instead of
@restrepo
restrepo / .gitignore
Created November 26, 2012 21:14
GitIgnore for LaTeX Project
*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl
@restrepo
restrepo / master2single.py
Created December 4, 2012 18:18
Convert a LaTeX master file into a flatten LaTeX with all the files included
#!/usr/bin/env python
"""Convert a master latex file,
into a single document by including
automatically all the LaTeX documents
which are arguments of
\include or \input
ignoring any \includeonly
"""
import sys
if len(sys.argv)==3:
@restrepo
restrepo / sed-recursive.sh
Last active December 11, 2015 07:28
REGEX raplacement in a list of files
#!/usr/bin/env bash
pattern=$1
replace=$2
list=$3
if ! [ $replace ]; then
echo USAGE: $0 PATTERN REPLACEMENT LIST
echo EXAMPLE: $0 \""R-\\([a-z]\\+\\)"\" \"\\\$R\\\$-"\1"\" \"\*.tex\"
fi
for i in $list; do
sed 's/'"$pattern"'/'"$replace"'/g' $i > /tmp/tmpfile
@restrepo
restrepo / InformeSostebilidad.ipynb
Last active August 29, 2015 13:55
InformeSostebilidad.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@restrepo
restrepo / Fit_Exponential.ipynb
Last active August 29, 2015 13:55
Logarithmic fit.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.