Skip to content

Instantly share code, notes, and snippets.

books = Service(name='v2/books',
path='v2/books',
renderer='json',
accept='application/json')
...
@books.get(content_type="application/json")
def get_books(request: Request):
(venv35) ~/webapp/websauna-myapp/venv35/myapp ᐅ ws-alembic -c myapp/conf/development.ini -x packages=all revision --auto -m "Initial migration"
Traceback (most recent call last):
File "/Users/maz/webapp/websauna-myapp/venv35/bin/ws-alembic", line 9, in <module>
load_entry_point('websauna', 'console_scripts', 'ws-alembic')()
File "/Users/maz/webapp/websauna-myapp/venv35/src/websauna/websauna/system/devop/scripts/alembic.py", line 15, in main
load_entry_point('alembic', 'console_scripts', 'alembic')()
File "/Users/maz/webapp/websauna-myapp/venv35/lib/python3.5/site-packages/alembic/config.py", line 479, in main
CommandLine(prog=prog).main(argv=argv)
File "/Users/maz/webapp/websauna-myapp/venv35/lib/python3.5/site-packages/alembic/config.py", line 473, in main
self.run_cmd(cfg, options)
(venv361) ~/webapp/websauna-myapp/myapp ᐅ ws-pserve myapp/conf/development.ini
Traceback (most recent call last):
File "/Users/maz/webapp/websauna-myapp/venv361/bin/ws-pserve", line 11, in <module>
load_entry_point('websauna', 'console_scripts', 'ws-pserve')()
File "/Users/maz/webapp/websauna-myapp/venv361/src/websauna/websauna/system/devop/scripts/pserve.py", line 19, in main
load_entry_point('pyramid', 'console_scripts', 'pserve')()
File "/Users/maz/webapp/websauna-myapp/venv361/lib/python3.6/site-packages/pyramid/scripts/pserve.py", line 40, in main
return command.run()
File "/Users/maz/webapp/websauna-myapp/venv361/lib/python3.6/site-packages/pyramid/scripts/pserve.py", line 225, in run
app_spec, name=app_name, relative_to=base, global_conf=vars)
root@faithfulaudio:~# cat /var/log/nginx/kjvrvg.access.log
24.36.220.141 - - [17/Jul/2017:03:32:36 +0000] "GET / HTTP/1.1" 200 396 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0"
24.36.220.141 - - [17/Jul/2017:03:32:36 +0000] "GET /favicon.ico HTTP/1.1" 404 143 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0"
24.36.220.141 - - [17/Jul/2017:03:32:36 +0000] "GET /favicon.ico HTTP/1.1" 404 143 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0"
66.87.132.79 - - [17/Jul/2017:03:33:24 +0000] "GET / HTTP/1.1" 200 396 "http://m.facebook.com" "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) Mobile/14F89 [FBAN/MessengerForiOS;FBAV/126.0.0.28.75;FBBV/64550700;FBDV/iPhone6,1;FBMD/iPhone;FBSN/iOS;FBSV/10.3.2;FBSS/2;FBCR/Boost;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]"
208.104.188.128 - - [17/Jul/2017:03:34:29 +0000] "GET / HTTP/1.1" 200 396 "-" "Mozilla/5.0 (Win
# Redirect all HTTP traffic to HTTPS
# Serve HTTP/HTTPS traffic
server {
listen 52.24.43.193:80;
server_name kjvinternational.co;
root@52:/etc/nginx/sites-enabled# sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
To Action From
-- ------ ----
22/tcp ALLOW IN Anywhere
80/tcp ALLOW IN Anywhere
@mazz
mazz / elixir_xml.exs
Created July 4, 2017 02:51 — forked from spint/elixir_xml.exs
Elixir XML processing (to JSON) with SweetXML
# mix.exs file dependencies:
# defp deps do
# [
# {:sweet_xml, "~> 0.4.0"},
# {:json, "~> 0.3.0"}
# ]
# end
defmodule ElixirXml do
import SweetXml
@mazz
mazz / partial_models.py
Created June 7, 2017 20:33
Migration fails when changing to single table inheritance
class MediaBase(Base):
#: The table in the database
__tablename__ = "mediabase"
#: Database primary key for the row (running counter)
id = Column(Integer, autoincrement=True, primary_key=True)
# table inheritance
media_type = Column(String(32), nullable=False)
@mazz
mazz / gist:ff7a9b48419c2413893bbfefc97f9787
Created June 6, 2017 02:00
How to Setup PayPal Donations/Transactions -- see comment
see comment below for instructions.
{
"result": [
{
"bid": "e931ea58-080f-46ee-ae21-3bbec0365ddc",
"title": "Matthew"
},
{
"bid": "e5612c8e-5d77-4e95-b462-4f7c1d90ad80",