Skip to content

Instantly share code, notes, and snippets.

View geoffeg's full-sized avatar
🏠
Working from home

Geoffrey Gallaway geoffeg

🏠
Working from home
View GitHub Profile
4−3−23. Use of Aircraft Lights
a. Aircraft position lights are required to be lighted on aircraft operated on the surface and in flight from sunset to sunrise. In addition, aircraft equipped with an anti−collision light system are required to operate that light system during all types of operations (day and night). However, during any adverse meteorological conditions, the pilot−in−command may determine that the anti−collision lights should be turned off when their light output would constitute a hazard to safety (14 CFR Section 91.209). Supplementary strobe lights should be turned off on the ground when they adversely affect ground personnel or other pilots, and in flight when there are adverse reflection from clouds.
b. An aircraft anti−collision light system can use one or more rotating beacons and/or strobe lights, be colored either red or white, and have different (higher than minimum) intensities when compared to other aircraft. Many aircraft have both a rotating beacon and a strobe light system.
c. T
#!/bin/sh
function get_stream_url {
local intermediate_url=`curl -s $1 | awk -F '=' '/File1/ { print \$2 }'`
local stream_url=`curl -L -I -o /dev/null -s -w %{url_effective} $intermediate_url`
echo "$stream_url"
}
read -p "Left channel URL [KSTL App]: " left;
read -p "Right channel URL [KSTL Tower]: " right;
left_stream=$(get_stream_url ${left:-http://www.liveatc.net/play/kstl_app.pls});
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-90.15458106994629,38.57038097962376]}},{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-90.50700187683105,38.72784024988615]}},{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-90.428466796875,38.92870117926206]}}]}
(defn search-weather [qparams remote-addr]
; three search methods are supported:
; zipcode=XXXXX return airports within proximity to zipcode
; geo=lat,lon return airports within proximity of coords
; ip=XXX.XXX.XXX.XXX airports within geolocation of IP address
; ip=@detect airports within geolocation of client IP
(when (= (get qparams :ip) "@detect") (assoc qparams :ip remote-addr))
(let? [geoloc (get-location qparams) :is-not nil? :else (error-response "could not find location")
stations (db/find-stations (qparams :type) geoloc) :is-not nil? :else (error-response "no stations found for location")
reports (if
@geoffeg
geoffeg / badmaps.clj
Last active December 22, 2015 21:09
Find the matching key in qparams and parammap and execute the matching parammap value with the qparam value as the argument.
(let [qparams {"cat" "meow"}
parammap {"cat" #(println "feline says" %), "dog" #(println "canine says" %)}
foundparam (into {} (filter #(contains? parammap (key %)) qparams))]
((get parammap (key (first foundparam))) (val (first foundparam))))
;> feline says meow
; Cleaner?
(let [queryparams {:cat "meow", :cheese "nonsense"}
functionmap {:cat #(println "feline says" %), :dog #(println "canine says" %)}
selectedkey (first (select-keys functionmap (keys queryparams)))]
; Thanks to http://stackoverflow.com/questions/18202661/casting-values-of-a-map-to-their-proper-types-in-clojure
; for the basis for this, I needed to also support cases where a value in `input` was empty when the cast occured.
(def input {:a "1" :b "2.5" :c "more" :d "string" :e "keys" :f ""})
(def typetrans {:a #(Long/parseLong %) :b #(Double/parseDouble %) :f #(Integer/parseInt %)})
(defn cast-fields [csvmap]
(reduce-kv
(fn [acc k v]
@geoffeg
geoffeg / map-cast.clj
Last active December 20, 2015 23:39
Convert a map's values into their proper type.
; Given a map where the values are numeric types contained in a string
; Convert the values to the type defined in a map of field types.
(mapv #(case ({"one" :int, "point-two" :float} (key %))
:int {(key %) (Integer/parseInt (val %))}
:float {(key %) (Float/parseFloat (val %))}
{(key %) (val %)}) ; For strings, just return the original values if there was no type defined
{"one" "1", "point-two" ".2", "three" "three"})
@geoffeg
geoffeg / gist:1786051
Created February 10, 2012 03:15
Final MongoDB fixed-sized array example.
db.searches.remove()
db.searches.save(
{_id: 1,
"searches-size" : 3,
"searches" : [
{"site" : "google", "q": "restaurants"},
{"site" : "yahoo", "q" : "shoes"},
{"site" : "bing", "q" : "cheap flights"}
]
}
@geoffeg
geoffeg / gist:1786043
Created February 10, 2012 03:13
Separate Mongodb fixed-size initial example.
db.searches.update(
{ _id : 1 },
{ $push : { "searches" : { "site" : "blekko.com", "q" : "mongodb" } } }
);
db.searches.update(
{ _id : 1 },
{ $pop : { "searches" : -1 } }
)
@geoffeg
geoffeg / gist:1785380
Created February 10, 2012 01:44
initial mongodb fixed-array example
> db.searches.save(
{_id: 1,
"searches" : [
{"site" : "google", "q": "restaurants"},
{"site" : "yahoo", "q" : "shoes"},
{"site" : "bing", "q" : "cheap flights"}
]
}
)
> db.searches.update(