Skip to content

Instantly share code, notes, and snippets.

@Gabriel-p
Gabriel-p / ptsampler.py
Last active September 7, 2019 13:09
resume ptemcee sampler
# Define the sampler
ptsampler = sampler.Sampler()
available_time = # some number of hours (seconds)
pos0 = # some initial random positions
# Timing params
elapsed, start_t = 0, t.time()
# Fixed number of steps
@Gabriel-p
Gabriel-p / iraf.txt
Created May 12, 2017 12:28
IRAF install steps
http://www.astronomy.ohio-state.edu/~khan/iraf/iraf_step_by_step_installation_64bit
# Fix fitparams issue
cd /iraf/iraf/noao/bin.linux64/
sudo rm x_photcal.e
sudo wget ftp://iraf.noao.edu/iraf/v216/support/linux/x_photcal.e
sudo chmod +x x_photcal.e
@Gabriel-p
Gabriel-p / resize_images
Created January 29, 2017 02:41
Resize all images in folder, renaming them
for file in *.png; do convert $file -resize 50% rszd_$file.png; done
@Gabriel-p
Gabriel-p / remove-annotations.sh
Created September 16, 2016 13:31 — forked from stefanschmidt/remove-annotations.sh
Remove all annotations from a PDF document
pdftk original.pdf output uncompressed.pdf uncompress
LANG=C sed -n '/^\/Annots/!p' uncompressed.pdf > stripped.pdf
pdftk stripped.pdf output final.pdf compress
from decimal import Decimal
import numpy as np
def format_5(f):
"""
Round floats that end with a '5' correctly, bypassing Python's issue
with the round() function.
See: http://codereview.stackexchange.com/q/122243/35351
import numpy as np
from random import randint
from decimal import Decimal
from math import log10, floor
def floats_5(N):
"""
Generate random floats between a random range, where all floats
end with a '5'.
avconv -i input.mkv -vcodec copy -acodec libmp3lame -ab 128k output.mkv
@Gabriel-p
Gabriel-p / changecolor.sh
Created March 9, 2016 19:58
Themer for elementary OS Terminal (needs work)
#!/bin/bash
# Origin:
# https://github.com/karlapsite/eos/blob/master/Scripts/changeColor.sh
# Theme generator (use 'Terminal' to output)
# http://ciembor.github.io/4bit/#
# Assign value if variable is unset or null.
var_run="do"
import numpy as np
from scipy.ndimage.filters import maximum_filter
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage.morphology import generate_binary_structure, binary_erosion
from scipy import stats
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.offsetbox as offsetbox
# from mpl_toolkits.axes_grid1 import make_axes_locatable