Skip to content

Instantly share code, notes, and snippets.

View dblackdblack's full-sized avatar

David Black dblackdblack

  • Benchling
  • San Francisco
View GitHub Profile
Index: Userdoc.pm
===================================================================
--- Userdoc.pm (revision 38023)
+++ Userdoc.pm (working copy)
@@ -68,7 +68,7 @@
}
for my $file (files($user)) {
- my $data = File::Slurp::read_file($file);
+ my $data = File::Slurp::read_file($file); # BP-1806 ok
===================================================================
--- perllib/bepress/ArticleStorage.pm (revision 38147)
+++ perllib/bepress/ArticleStorage.pm (working copy)
@@ -1164,15 +1164,21 @@
# within it. $to won't have a representation in the ArticleStorage layer.
#
# $to_path is not constrained to be under fsroot, or even expected to be under there.
+# $to_path might also be a filehandle to be written to, rather than a path.
#
##########################################
@dblackdblack
dblackdblack / formatjson.py
Created September 6, 2013 23:55
formatjson.py
#!/usr/bin/env python
import fileinput
import json
import re
if __name__ == "__main__":
jsonStr = ''
for a_line in fileinput.input():
jsonStr = jsonStr + ' ' + a_line.strip()
As I may have mentioned, I've been working on a way to integrate our existing MQWorker infrastructure to use celery. This would give us the suite of management/monitoring/remote control tools that comes with celery. And presumably all future python async workers would be written in celery. So here we go:
# Integrating Celery ↔ MQWorkers
## Celery uses [webhooks](http://docs.celeryproject.org/en/latest/userguide/remote-tasks.html) in order to call functions written in other languages (e.g. MQWorker)
1. Run a starman instance that takes the name of the MQWorker class as a path element in an HTTP GET URL e.g. http://127.0.0.1:8181/StampPDF will cause an instance of bepress::MQWorker::StampPDF to be instantiated.
1. (α/β-quality) code for a .psgi that does this is checked in [here](https://fisheye.bepress.com/browse/main/trunk/psgi/worker.psgi)
2. `start_server --port 8181 --signal-on-hup=QUIT --signal-on-term=QUIT -- /path/to/starman --workers 4 --preload-app $FILETREE/psgi/worke
#################################################
# Makefile for bepress-pythonz deb package
#
# pythonz (https://github.com/saghul/pythonz) is the python equivalent of perlbrew
# (there is also a 'pythonbrew' package, but it is unmaintained, which is why
# pythonz was forked from pythonbrew)
#
# This package contains an installed copy of pythonz with a pre-compiled (for
# amd64) copy of python 3.3.2. It installs into /opt/bepress/pythonz.
# Python 3.3.2 ends up in /opt/bepress/pythonz/pythons/CPython-3.3.2
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.10 (GNU/Linux)
mQENBFIyTH4BCADFickcUG1UmhTnOYwJsVbeZ0edbRlvawrf/x46itiStxJYIINM
XiiIf7KEdcnKlM412W2jRznXVD0caJ2J2nzK8puMl68BY+wekvCLYAWFl6yadSPz
Ln/TNPBa6vO1tNOaRiFe7mOMtFPVZaytsr4IsWAQTGAjwdsuJ48MiLXAWoGJZUTI
DjF2d4APW/wupDqGlN1nDAybk25ZKJIl8PrwcFfWVIS4FLXCeJUaILHkuz6HiDjG
o17KAx/VhUmRquGMJ7CZ0ijlJ1AoKZ5Q67SVqi1a2YZlUixXsFPwB+q4rHEVBhH8
Yb612sF3gAxsOinSJXJdmsMsHz/yDr3f0psxABEBAAG0THN0ZXdhcmQgb24gb3Bz
LXV0aWwgKGZvciBzaWduaW5nIHRoZSBpbi1ob3VzZSBkZWJpYW4gcmVwbykgPG9w
@dblackdblack
dblackdblack / control
Last active December 28, 2015 19:59
control file for bepress-pythonz
Package: bepress-pythonz
Version: 1:1.20131011-1
Section: python
Priority: optional
Architecture: amd64
Depends: bash
Installed-Size: 84506102
Maintainer: David Black [dblack@bepress.com]
Description: Install pythonz into /opt/bepress with python 3.3.2 for amd64 wheezy
pythonz is the python equivalent of perlbrew: it allows you to download/compile/install multiple versions of python on the same system
@dblackdblack
dblackdblack / gist:7555320
Created November 20, 2013 00:37
svlogd.gz
H4sIAP18BFAAA+29C3gUVdIw3DOTIUMImSCgkYuMGDSICYkCJkBkQhLSkaBBQVBRcpuQSG7O9BBQ
VsNOgukdo/G2y+u6K7ruyu7qyr7rxgHdEG4JeNuIqHglAkIPAcyKQOTWf1Wd0zM9k8Td7//f/3u+
/38cnlBddarOqVOnTp06p3t6Hs7Om2M0GATtYxRuEhDbaLUTbud08ZkAC9BSBQv8P1YYIwwC3Kzj
swv2ENjGq9aghfOZ4C+CNcgbtofAMZysQYMOmgX9xx4C93qEECgItoAc6io0c3JzQQi0RTC0zhoq
Z+RyCVwugfNrcD1XbH1Y/yL43xjevzFavzjM4nxZOn785H8jleB1r4vhvS57CMwzCSFQk5sPcoOE
//yj6Tm5orxo2pTJFSWJFeVV7pWJK1OnJU6bkuSqTrqe6o4VmO1ybllI/Jo9LuFtjxDYWGL5G0MH
S5YJX3WNi7/LeN+0RWn//PiOAxOgbBL8XQZ/E+FvGG/XBn9X6PTBOobA3+Ucv4RDbB994Er4i4O/
cVx3rDce/sZzffBzLYcxXC/8XA1/0fA3Fv60oR0Mf5f+L9hK/4nicCj8RfLrhAF4R3KI9hsFf8P7
4THqrtGvr+LXowVm32s4jva5Wgj6cTKYcJtQRDRsH/v+hy9/t3ynbG7esek5+z3nn1/tbnw+dqB+
oN0u6Yf+3QB0bNfWD/3dAfhfHIDeMgB9vKF/etoA/IsGoJcMQF81AH36AO3+YwD+UQPwJwzAHzMA
@dblackdblack
dblackdblack / gist:7555362
Last active December 28, 2015 20:09
log/run
#!/bin/bash
# want to use the copy of svlogd in /usr/local/bin b/c it contains the -tttt feature
# which is absent from the official svlogd. -tttt emits timestamps in localtime as
# opposed to GMT (which is what you get from the official -ttt flag)
exec 2>&1
exec /opt/local/sbin/svlogd -tttt main
[uwsgi]
chdir = $(CATDOOR_ROOT)/opus
virtualenv = /opt/bepress/virtualenvs/opus
env = DJANGO_SETTINGS_MODULE=opus.settings
attach-daemon = /opt/bepress/virtualenvs/opus/bin/python manage.py register_zookeeper