Function | Shortcut |
---|---|
New Tab | ⌘ + T |
Close Tab or Window | ⌘ + W (same as many mac apps) |
Go to Tab | ⌘ + Number Key (ie: ⌘2 is 2nd tab) |
Go to Split Pane by Direction | ⌘ + Option + Arrow Key |
Cycle iTerm Windows | ⌘ + backtick (true of all mac apps and works with desktops/mission control) |
This file contains hidden or 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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains hidden or 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 plotly.subplots import make_subplots | |
df2 = df[df.Magnitude < 7].copy() | |
df1 = df[df.Magnitude >= 7].copy() | |
fig = make_subplots( | |
rows=2, cols=2, | |
column_widths=[0.5, 0.5], | |
row_heights=[0.4, 0.6], | |
specs=[[{"type": "scattergeo", "colspan": 2}, None ], |
This file contains hidden or 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
fig = go.Figure(data=go.Scattergeo( | |
lon = df['Longitude'], | |
lat = df['Latitude'], | |
text = [df['Magnitude'], df['date']], | |
mode = 'markers', | |
marker = dict( | |
size = 8, | |
opacity = 0.8, | |
autocolorscale = False, | |
symbol = 'diamond', |
This file contains hidden or 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
fig = go.Figure(data=go.Scattergeo( | |
lon = df['Longitude'], | |
lat = df['Latitude'], | |
text = [df['Magnitude'], df['date']], | |
mode = 'markers', | |
marker_color = df['Magnitude'], | |
)) | |
fig.update_layout( | |
title = 'Significant earthquakes since the year 2000', |
This file contains hidden or 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 plotly.express as px | |
import plotly.io as pio | |
pio.renderers.default = 'browser' | |
fig = px.scatter_geo(df, lat = "Latitude", lon = "Longitude") | |
pio.show(fig) |
This file contains hidden or 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
""" | |
A script to take all of the LineString information out of a very large KML file. It formats it into a CSV file so | |
that you can import the information into the NDB of Google App Engine using the Python standard library. I ran this | |
script locally to generate the CSV. It processed a ~70 MB KML down to a ~36 MB CSV in about 8 seconds. | |
The KML had coordinates ordered by | |
[Lon, Lat, Alt, ' ', Lon, Lat, Alt, ' ',...] (' ' is a space) | |
The script removes the altitude to put the coordinates in a single CSV row ordered by | |
[Lat,Lon,Lat,Lon,...] |