Skip to content

Instantly share code, notes, and snippets.

View bhagany's full-sized avatar

Brent Hagany bhagany

  • Etsy
  • Appleton, WI
View GitHub Profile
diff --git a/boot/core/src/boot/task_helpers.clj b/boot/core/src/boot/task_helpers.clj
index 13089cc..8110f6c 100644
--- a/boot/core/src/boot/task_helpers.clj
+++ b/boot/core/src/boot/task_helpers.clj
@@ -117,12 +117,14 @@
(defmethod sift-action :move
[_ _ args]
(let [proc #(reduce-kv string/replace % args)
- reducer (fn [xs k v]
- (let [k (proc k)]
(defn undo-migration-data
[edit-migration with-migration-db undo tx-id store-id version-id]
(let [undo-tx (-> undo :design.undo/tx :db/id)
original-undo-tx (or (-> undo
:design.migration/original-tx
:db/id)
undo-tx)
undo-migration (migration-fn (d/as-of db original-undo-tx)
tx-id
version-id)

Keybase proof

I hereby claim:

  • I am bhagany on github.
  • I am bhagany (https://keybase.io/bhagany) on keybase.
  • I have a public key whose fingerprint is 905B CF08 73B3 4B7E 977A 25E0 9D1B A651 78F5 C290

To claim this, I am signing this object:

@bhagany
bhagany / db.clj
Last active September 26, 2015 19:55
(defrecord DatascriptS3Db [bucket key-name schema conn-ch]
component/Lifecycle
(start [this]
(let [s3-conn-ch (chan 1 (map (s3-obj->conn schema)))
conn-ch (chan)]
(pipe (u/get-obj-ch bucket key-name) s3-conn-ch)
(go-loop [conn nil]
(let [conn* (if conn
conn
(<! s3-conn-ch))]
@bhagany
bhagany / db.clj
Created September 26, 2015 16:52
(defrecord DatascriptS3Db [bucket key-name schema conn-ch conn]
component/Lifecycle
(start [this]
(let [conn-ch* (chan 1 (map (s3-obj->conn schema)))]
(pipe (u/get-obj-ch bucket key-name) conn-ch*)
(assoc this :conn-ch (go-loop
(if conn
conn
(<! conn-ch*))))))
(stop [this]
[{:db/id #db/id[:db.part/db]
:db/ident :store/id
:db/valueType :db.type/long
:db/cardinality :db.cardinality/one
:db/doc "A store id, matching postgres"
:db/unique :db.unique/value
:db.install/_attribute :db.part/db}
{:db/id #db/id[:db.part/db]
:db/ident :store/publish-tx
:db/valueType :db.type/long
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetEnabledProductsResponse xmlns="http://Cafepress.com/">
<GetEnabledProductsResult>
<CPProductType>
<CPProductTypeNo>2</CPProductTypeNo>
<ProductDescription>White T-Shirt</ProductDescription>
</CPProductType>
<CPProductType>

Migration

Using mysql-postgresql-converter

  1. cd into goodsie/
  2. mysqldump --compatible=postgresql --default-character-set=utf8 -r goodsie.mysql -u <insert local goodsie username> --password=<insert local goodsie password> goodsie
    Export mysql DB
  3. python dbconverter.py goodsie.mysql goodsie.psql
    Convert to postgres SQL
% celery -A myproj worker -l debug
[2014-07-21 22:29:32,362: DEBUG/MainProcess] | Worker: Preparing bootsteps.
[2014-07-21 22:29:32,368: DEBUG/MainProcess] | Worker: Building graph...
[2014-07-21 22:29:32,369: DEBUG/MainProcess] | Worker: New boot order: {Timer, Hub, Queues (intra), Pool, Autoreloader, Autoscaler, Beat, StateDB, Consumer}
[2014-07-21 22:29:32,375: DEBUG/MainProcess] | Consumer: Preparing bootsteps.
[2014-07-21 22:29:32,375: DEBUG/MainProcess] | Consumer: Building graph...
[2014-07-21 22:29:32,384: DEBUG/MainProcess] | Consumer: New boot order: {Connection, Agent, Events, Mingle, Tasks, Control, Gossip, Heart, event loop}
-------------- [email protected] v3.1.13 (Cipater)
---- **** -----
[ec2-54-91-33-121.compute-1.amazonaws.com] out: Recipe: newrelic::server-monitor-agent
[ec2-54-91-33-121.compute-1.amazonaws.com] out: package[newrelic-sysmond] action install (up to date)
[ec2-54-91-33-121.compute-1.amazonaws.com] out: template[/etc/newrelic/nrsysmond.cfg] action create
[ec2-54-91-33-121.compute-1.amazonaws.com] out: - update content in file /etc/newrelic/nrsysmond.cfg from 7f14d2 to 502795
[ec2-54-91-33-121.compute-1.amazonaws.com] out: --- /etc/newrelic/nrsysmond.cfg 2014-06-23 22:05:47.174755801 +0000
[ec2-54-91-33-121.compute-1.amazonaws.com] out: +++ /tmp/chef-rendered-template20140715-19158-1uxcflq 2014-07-15 20:37:04.574755803 +0000
[ec2-54-91-33-121.compute-1.amazonaws.com] out: @@ -1,3 +1,7 @@
[ec2-54-91-33-121.compute-1.amazonaws.com] out: +###################
[ec2-54-91-33-121.compute-1.amazonaws.com] out: +# Generated by Chef
[ec2-54-91-33-121.compute-1.amazonaws.com] out: +###################