This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM centos:centos7 | |
RUN yum -y update; yum clean all | |
RUN yum -y install epel-release sudo | |
RUN yum -y install zsh vim tmux git git-gui bzip2 | |
RUN yum -y install gcc cscope valgrind freeglut-devel | |
RUN yum -y install python36 python36-pip | |
RUN pip3.6 install pip --upgrade | |
RUN pip3.6 install ipython |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import time | |
import curses | |
sudoku = """ | |
0 0 0 0 0 0 0 0 0 | |
0 0 8 0 0 0 0 4 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 6 0 0 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
if [ $# != 2 ]; then | |
echo "USAGE: $(basename $0) <file> <number>" | |
exit 1 | |
fi | |
args=("$@") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import struct | |
from argparse import ArgumentParser | |
from socket import socket, AF_INET, SOCK_DGRAM, IPPROTO_ICMP | |
ICMP_ECHO_REQUEST = 8 | |
def ip_checksum(databuf, s=0): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
import copy | |
import asdf | |
from astropy import modeling | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from astropy import units as u | |
from astropy.modeling import models | |
from specutils import Spectrum1D | |
mean = 5 | |
frequencies = np.linspace(1, mean*2, 100) * u.GHz | |
g1 = models.Gaussian1D(amplitude=5*u.Jy, mean=mean*u.GHz, stddev=0.8*u.GHz) | |
spectrum = Spectrum1D(spectral_axis=frequencies, flux=g1(frequencies)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import asdf | |
import numpy as np | |
tree = dict() | |
tree['top'] = dict(foo=42, bar='hello', nums=np.array([x for x in range(100)])) | |
with asdf.AsdfFile(tree) as af: | |
af.write_to('test.asdf') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""A simple example demonstrating how a compound model can be overridden""" | |
import sys | |
from astropy.modeling.models import Polynomial1D | |
from astropy.modeling.core import _CompoundModel | |
import asdf | |
from asdf import CustomType |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from astropy.io import fits | |
from astropy.io.fits import HDUList, ImageHDU | |
from asdf.fits_embed import AsdfInFits | |
import numpy as np | |
get_ipython().run_line_magic('rm', '-f asdf.fits') | |
image = ImageHDU(np.random.random(1000)) | |
hdulist = HDUList() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import asdf | |
from astropy import units as u | |
from astropy.coordinates.representation import SphericalRepresentation | |
tree = {'coord': SphericalRepresentation(10*u.deg, 10*u.deg, 1*u.m)} | |
print('distance:', tree['coord'].distance) | |
with asdf.AsdfFile(tree=tree) as ff: | |
ff.write_to("test.asdf") |
NewerOlder