Ruby hashes can have keys of any type, but Strings and Symbols are the most common.
For symbol keys there is a special syntax (similar to Javascript's object literal syntax).
{ "this is a string key" => 3 }
alert("i'm a popup") |
#!/bin/bash | |
# Log and graph peformance metrics on a single process | |
# Based on: http://brunogirin.blogspot.com.au/2010/09/memory-usage-graphs-with-ps-and-gnuplot.html | |
# | |
# Requires gnuplot to be installed and on your path. | |
# | |
# Run: ./process_graph [process name] [pid] | |
DEFAULT_PROCNAME="Xorg" |
require "yaml" | |
require "json" | |
puts YAML.dump(JSON.load(YAML.load_file(ARGV.first).to_json)) |
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md | |
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192 | |
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB. | |
------------ | |
-- Basics -- | |
------------ | |
-- Get indexes of tables |
sudo apt-get update | |
sudo apt-get -y install \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg-agent \ | |
software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ |
<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"><Document><name>cb_2018_us_county_20m</name><visibility>1</visibility><LookAt><longitude>-102</longitude><latitude>38.5</latitude><heading>0</heading><tilt>10</tilt><range>7000000</range></LookAt><Style id="KMLStyler"><LineStyle><color>ffbc822f</color><width>2</width><gx:labelVisibility>0</gx:labelVisibility></LineStyle><PolyStyle><color>7fe1ca9e</color></PolyStyle><IconStyle><scale>0.8</scale><Icon></Icon></IconStyle><LabelStyle><scale>1.0</scale></LabelStyle></Style><Schema name="cb_2018_us_county_20m" id="kml_schema_ft_cb_2018_us_county_20m"><SimpleField type="xsd:string" name="STATEFP"><displayName>STATEFP</displayName></SimpleField><SimpleField type="xsd:string" name="COUNTYFP"><displayName>COUNTYFP</displayName></SimpleField><SimpleField type="xsd:string" name="COUNTYNS"><displayName>COUNTYNS</d |
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- Generated by FME 2017.1.2.0 (Build 17722) --> | |
<kml xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://www.opengis.net/kml/2.2"> | |
<Document><LookAt> | |
<longitude>-102</longitude> | |
<latitude>38.5</latitude> | |
<range>7000000</range> | |
<tilt>10</tilt> | |
<heading>0</heading> | |
</LookAt> |
#!/bin/bash | |
# Add to instance metadata with `gcloud compute instances add-metadata \ | |
# instance-name --metadata-from-file startup-script=idle-shutdown.sh` and reboot | |
# NOTE: requires `bc`, eg, sudo apt-get install bc | |
# Modified from https://stackoverflow.com/questions/30556920/how-can-i-automatically-kill-idle-gce-instances-based-on-cpu-usage | |
threshold=0.1 | |
count=0 | |
wait_minutes=60 | |
while true |
Heredocs are a way to write multi-line strings in Ruby. Some of their syntax can be a bit tricky to figure out, especially when calling methods on them as literals or passing them as arguments to methods, but both can be done!
Original, verbatim Heredoc with whitespace preserved
<<-EOF
This
reminds