Skip to content

Instantly share code, notes, and snippets.

View spara's full-sized avatar

Sophia Parafina spara

View GitHub Profile
@spara
spara / Dockerfile
Created June 6, 2017 17:03
Dockerfile for AtSea Shop Sample Application
FROM node:latest AS storefront
WORKDIR /usr/src/atsea/app/react-app
COPY react-app/package.json .
RUN npm install
COPY . /usr/src/atsea/app
RUN npm run build
FROM maven:latest AS appserver
WORKDIR /usr/src/atsea
COPY pom.xml .
@spara
spara / geoserver-ubuntu-ec2-install.sh
Created March 23, 2011 02:50
Installs GeoServer on Canonical ubuntu EC2 AMI, GeoServer is proxied through apache
#
# install Geoserver on Ubuntu Maverick 10.10
# note: Geoserver is proxied through apache so port 8080 is not used
#
# @spara 11/15/10
#
# setup sources
sudo sh -c "echo ' ' >> /etc/apt/sources.list"
sudo sh -c "echo 'deb http://us.archive.ubuntu.com/ubuntu/ maverick multiverse' >> /etc/apt/sources.list"

Rails on Docker

Note: many issues listed below are not specific to Rails or to Ruby. They can also exist in other languages or web frameworks presenting similar challeneges. It is important to note these challenges, because they can impede the workflow and best practices taught and used by Rails practitioners.

Challenges and Remediations

Different versions of Ruby

There are many different versions of Ruby in use. This is very unique, in that, in the Python world, you have many versions, but almost everyone will be using the last 2.X or the last 3.X. In the Java world, most use cases are covered by the last two major releases of either Java released by Oracle or on OpenJDK.

@spara
spara / WKT_examples
Created November 11, 2011 15:45
Examples of Well Known Text for simple feature types
Point: Point (10 10)
LineString: LineString ( 10 10, 20 20, 30 40)
Polygon: Polygon ((10 10, 10 20, 20 20, 20 15, 10 10))
Multipoint: MultiPoint ((10 10), (20 20))
MultiLineString: MultiLineString ((10 10, 20 20), (15 15, 30 15))
@spara
spara / geo_header_to_postgres.sql
Created January 10, 2012 20:22
Import 2010 Census geo_header file into Postgresql
INSERT INTO geo_header_sf1 (fileid, stusab, sumlev, geocomp, chariter, cifsn, logrecno, region, division, state, county, countycc, countysc, cousub, cousubcc, cousubsc, place, placecc, placesc, tract, blkgrp, block, iuc, concit, concitcc, concitsc, aianhh, aianhhfp, aianhhcc, aihhtli, aitsce, aits, aitscc, ttract, tblkgrp, anrc, anrccc, cbsa, cbsasc, metdiv, csa, necta, nectasc, nectadiv, cnecta, cbsapci, nectapci, ua, uasc, uatype, ur, cd, sldu, sldl, vtd, vtdi, reserve2, zcta5, submcd, submcdcc, sdelem, sdsec, sduni, arealand, areawatr, name, funcstat, gcuni, pop100, hu100, intptlat, intptlon, lsadc, partflag, reserve3, uga, statens, countyns, cousubns, placens, concitns, aianhhns, aitsns, anrcns, submcdns, cd113, cd114, cd115, sldu2, sldu3, sldu4, sldl2, sldl3, sldl4, aianhhsc, csasc, cnectasc, memi, nmemi, puma, reserved)
SELECT
trim(substring(data,1,6)) AS fileid,
trim(substring(data,7,2)) AS stusab,
trim(substring(data,9,3)) AS sumlev,
trim(substring(data,12,2)) AS geocomp,
trim(substring(data,14,3)) AS
@spara
spara / create_SF1_tables.sql
Created January 10, 2012 20:25
Create 2010 Census SF1 tables
-- drop table data_field_descriptors;
create table data_field_descriptors
(
sort id integer,
segment varchar(4),
table number varchar(12),
field name varchar(510),
field code varchar(20),
decimal integer
);

Connecting to the web UI

  • link does not include port, and does not work

Setup tell student to explicitly use their docker hub username instead of

In the first terminal, set an environment variable for your Docker Hub user name. It can be the same user name that you used to log in to the terminals on this site.

===

FROM registry.access.redhat.com/rhel7/rhel
# Register container to access repositories
RUN subscription-manager register --username lenswipe2000 --password docker4thewin! --auto-attach
RUN yum-config-manager --disable rhel-7-server-rt-beta-rpms
# Install prepare infrastructure
RUN yum -y update && \
yum -y install wget && \
yum -y install tar
@spara
spara / join_food_access_to_census_tracts
Created October 15, 2015 17:02
Process for attaching Food Access data to Census tracts
#
# Food access data from USDA: http://www.ers.usda.gov/datafiles/Food_Access_Research_Atlas/Download_the_Data/Current_Version/DataDownload.xlsx
# data is in Microsoft Excel format, convert to CSV in your favorite spreadsheet software (note: too large for Google Sheets)
#
#
# create database in postgres
#
createdb -h localhost -p 5432 -U postgres food_access
appserver_1 | 2017-07-13 22:02:44.336 INFO 1 --- [ main] rmationExtractorJdbcDatabaseMetaDataImpl : HHH000262: Table not found: orders
database_1 | ERROR: column "product_id" contains null values
database_1 | STATEMENT: alter table product add column product_id int8 not null
appserver_1 | 2017-07-13 22:02:44.358 WARN 1 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
appserver_1 | 2017-07-13 22:02:44.359 INFO 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : Hikar