Skip to content

Instantly share code, notes, and snippets.

View bhagany's full-sized avatar

Brent Hagany bhagany

  • Etsy
  • Appleton, WI
View GitHub Profile
#!/usr/bin/env bash
# Delete .pyc files and empty directories from root of project
cd ./$(git rev-parse --show-cdup)
# Clean-up
find . -name ".DS_Store" -delete
NUM_PYC_FILES=$( find . -name "*.pyc" | wc -l | tr -d ' ' )
if [ $NUM_PYC_FILES -gt 0 ]; then
]
corrected_rules = {
'.st-module-checkout-custom-form': 18,
'.st-module-checkout-custom-form-field': 19,
'.st-module-checkout-paragraph': 20,
}
class Migration(DataMigration):
[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: +###################
% 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)
---- **** -----

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
<?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>
[{: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
@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]
@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))]

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: