Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
file="./final/merge.shp"
for i in $(ls *.shp)
do
if [ -f "$file" ]
then
echo "creating final/merge.shp"

Scriptz

Script 1: Returns new DF

import os
filepath = os.path.join(os.getcwd(), 'sample_wind_data.csv')
import pandas as pd 
df = pd.read_csv(filepath) 
df1 = df.head(50)

indices = []

Sample script

import pandas
import os
filepath = os.path.join(os.getcwd(), 'sample_wind_data.csv')

import pandas as pd 
# Read data from file 'filename.csv' 
# (in the same directory that your python process is based)
# Control delimiters, rows, column names with read_csv (see later) 
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Display a map</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Change a map's style</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.48.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.48.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
FROM ubuntu:14.04
WORKDIR /src/app #you can create a working dir if you want
RUN apt-get update -y && apt-get install -y curl
RUN curl <install a program>
RUN ./scripts/install.sh
@millzpaugh
millzpaugh / composite_log_parser.js
Created July 26, 2018 16:07
parses aws elb logs to filter out non-composite requests
let count = 0;
fs.readFileSync('./07-11-log-pull.log').toString().split('\n').forEach(function (l) {
try{
const tsvFile = /(?<=GET).*$/;
const d = tsvFile.exec(l);
if (d) {
const v = d[0].split(' ')[1].split('/')[4];
const mapidCount = v ? v.split(',').length : 0;
if (mapidCount > 1){
count+=1;
--/api/business_license/application_data/complaint_id
SELECT *
FROM [Building].[dbo].[Complaint] c
left outer JOIN [Building].[dbo].[User_Defined_Action] uda
ON c.complaint_id = uda.parent_id
left outer JOIN [Building].[dbo].[User_Defined_Action_Type] udat
ON uda.user_defined_action_type_id = udat.user_defined_action_type_id
WHERE c.complaint_number = 'CU2014-0050'
--/api/business_license/inspection_data/complaint_id
days_each_month = {1: 31, 2:28, 3:31, 4:30, 5:31, 6:30, 7:31, 8:31, 9:30, 10:31, 11:30, 12:31}
class Datetime(object):
def __init__(self, year, month, day):
self.day = day
self.month = month
self.year = year
class Package(object):