This file contains 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
(defn filter-by-val-1 | |
[pred m] | |
(into {} (filter (fn [[k v]] (pred v)) | |
m))) | |
;; This one is a little faster | |
(defn filter-by-val-2 | |
[pred m] | |
(persistent! | |
(reduce-kv (fn [acc k v] |
This file contains 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
Process: TablePlus [5322] | |
Path: /Applications/TablePlus.app/Contents/MacOS/TablePlus | |
Identifier: com.tinyapp.TablePlus | |
Version: 2.8.3 (259) | |
Code Type: X86-64 (Native) | |
Parent Process: ??? [1] | |
Responsible: TablePlus [5322] | |
User ID: 503 | |
Date/Time: 2019-09-13 11:19:10.648 -0400 |
This file contains 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
09-16 16:08:02 [1mWARN middleware.process-userland-query[0m :: Query failure [31m{:status :failed, | |
:class java.sql.SQLNonTransientConnectionException, | |
:error "(conn=6989) Connection timed out (Write failed)", | |
:stacktrace | |
("org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:234)" | |
"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:165)" | |
"org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:238)" | |
"org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:232)" | |
"org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)" | |
"org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:174)" |
This file contains 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
metabase/redux/metadata fetchDatabaseMetadata | |
v @ app-main.bundle.js?a0cb8a0cb1424da110c7:1 | |
app-main.bundle.js?a0cb8a0cb1424da110c7:1 Error getting setting graph.x_axis._is_timeseries TypeError: Cannot read property 'cols' of undefined | |
at Object.getDefault (app-main.bundle.js?a0cb8a0cb1424da110c7:1) | |
at g (app-main.bundle.js?a0cb8a0cb1424da110c7:1) | |
at t.getComputedSettings (app-main.bundle.js?a0cb8a0cb1424da110c7:1) | |
at h (app-main.bundle.js?a0cb8a0cb1424da110c7:1) | |
at t.value (app-main.bundle.js?a0cb8a0cb1424da110c7:1) | |
at t.value (app-main.bundle.js?a0cb8a0cb1424da110c7:1) | |
at u.performInitialMount (vendor.bundle.js?a0cb8a0cb1424da110c7:1) |
This file contains 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
class AirtableClient: | |
# ... | |
def request(self, method, *args, **kwargs): | |
# ... | |
retries = 0 | |
wait = 30 | |
while True: | |
response = self.session.request(method, *args, headers=headers, **kwargs) | |
if response.status_code != 429 or retries == 3: |
This file contains 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
def load(connection, airtable, table_name, field_info, destination): | |
restarts = 0 | |
while True: | |
try: | |
chunks = airtable.iter_chunks(table_name) | |
# Airtable will give us the records in chunks of 100, which is | |
# inefficiently small for loading into Snowflake, so buffer them up into | |
# chunks of a few thousand | |
chunks = rechunked(chunks, 5000) | |
return _load_chunks(connection, chunks, field_info, destination) |
This file contains 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
# Make sure the table is created in the db even if it's empty. This is ugly, | |
# including in that every column will have type `string`, but the types will be | |
# fixed up as soon as there's actual data to load | |
if count == 0: | |
nulls_df = result_to_df([], field_info) | |
nulls_df = pd.concat( | |
[nulls_df, pd.DataFrame([{c: None for c in nulls_df.columns}])] | |
) | |
nulls_df.to_sql( | |
# ... |
This file contains 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
;;; iterm.el - Send text to a running iTerm instance | |
(require 'pcase) | |
(require 'thingatpt) | |
;; To match SublimeText's key binding: | |
;; (global-set-key (kbd "<C-return>") 'iterm-send-text) | |
(defvar iterm-default-thing 'line | |
"The \"thing\" to send if no region is active. |
This file contains 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
;; An attempt at this Emacs SX question: | |
;; https://emacs.stackexchange.com/questions/10359/delete-portion-of-isearch-string-that-does-not-match-or-last-char-if-complete-m | |
(defun isearch-delete-something () | |
"Delete non-matching text or the last character." | |
;; Mostly copied from `isearch-del-char' and Drew's answer on the page above | |
(interactive) | |
(if (= 0 (length isearch-string)) | |
(ding) | |
(setq isearch-string |
This file contains 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 java.util.Objects; | |
/** | |
* Class representing a playing card from a standard 52-card deck. | |
*/ | |
public class Card | |
{ | |
/** | |
* Enum representing playing card suits. | |
*/ |
OlderNewer