Skip to content

Instantly share code, notes, and snippets.

~/webapp/phx/1.4.0-dev/dynt (master ✔) ᐅ rm -rf _build
~/webapp/phx/1.4.0-dev/dynt (master ✔) ᐅ ./build.sh
Sending build context to Docker daemon 434.2kB
Step 1/14 : FROM bitwalker/alpine-elixir-phoenix:1.6.4
1.6.4: Pulling from bitwalker/alpine-elixir-phoenix
2fdfe1cd78c2: Pull complete
2c0d9bb9fb45: Pull complete
d93f0b84684a: Pull complete
335734700e0f: Pull complete
a3bef11652be: Pull complete
@mazz
mazz / gist:d3ee18d0b8c6635c2d9118dbaedcd88d
Created May 25, 2018 02:11
docker-websauna app error
app | Error processing line 1 of /usr/local/lib/python3.5/site-packages/websauna-nspkg.pth:
app |
app | Traceback (most recent call last):
app | File "/usr/local/lib/python3.5/site.py", line 167, in addpackage
app | exec(line)
app | File "<string>", line 1, in <module>
app | File "<frozen importlib._bootstrap>", line 574, in module_from_spec
app | AttributeError: 'NoneType' object has no attribute 'loader'
app |
app | Remainder of file ignored
maz in websauna-docker at localhost on  master on 🐳 v17.12.0-ce
➜ docker-compose up
Starting db ... done
Starting redis ... done
Starting app ... done
Attaching to redis, db, app
redis | 1:C 19 May 05:04:58.343 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis | 1:C 19 May 05:04:58.343 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=1, just started
redis | 1:C 19 May 05:04:58.343 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis | 1:M 19 May 05:04:58.346 * Running mode=standalone, port=6379.
@mazz
mazz / unicode.patch
Created May 14, 2018 01:50
patches j2py to handle unicode
diff --git a/bin/j2py b/bin/j2py
index 6eb1a40..b618693 100755
--- a/bin/j2py
+++ b/bin/j2py
@@ -6,9 +6,11 @@ This is all very ordinary. We import the package bits, open and read
a file, translate it, and write it out.
"""
+from __future__ import unicode_literals
import sys
import Foundation
import AVFoundation
import RxSwift
import RxCocoa
extension Reactive where Base: AVURLAsset {
public var isPlayable: Observable<Bool> {
return self.observe(Bool.self, #keyPath(AVURLAsset.isPlayable))
.map { $0 ?? false }
}
global
lua-load /usr/local/etc/haproxy/acme-http01-webroot.lua
ssl-default-bind-ciphers AES256+EECDH:AES256+EDH:!aNULL;
tune.ssl.default-dh-param 4096
debug
defaults
mode http
option log-health-checks
option dontlognull
@mazz
mazz / docker-cleanup-resources.md
Created May 4, 2018 03:51 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@mazz
mazz / rtlsdr-osx.txt
Created March 26, 2018 02:41 — forked from jheasly/rtlsdr-osx.txt
Build RTL-SDR on OSX with no tears using homebrew. Forked from https://gist.github.com/0xabad1dea/5777726, a macports solution.
rtl-sdr build notes for OSX
using macports http://www.macports.org/
see http://sdr.osmocom.org/trac/wiki/rtl-sdr
brew install cmake
brew install libusb
brew install pkgconfig
brew install sox # for easy audio
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
@mazz
mazz / sqlalchemy.py
Created February 25, 2018 01:57
sqlalchemy many-to-many query examples
## every leader at every church -- OK
##
##
## query = dbsession.query(Leader).join(LeaderChurch).join(Church).filter(LeaderChurch.leader_id == Leader.id and LeaderChurch.church_id == Church.id)
## every leader at a particular church -- OK
##
##
# query = dbsession.query(Leader). \
@mazz
mazz / ChatCollectionViewFlowLayout.swift
Created February 21, 2018 02:26 — forked from jochenschoellig/ChatCollectionViewFlowLayout.swift
A subclass of UICollectionViewFlowLayout to get chat behavior without turning collection view upside-down. This layout is written in Swift 3 and absolutely usable with RxSwift and RxDataSources because UI is completely separated from any logic or binding.
import UIKit
class ChatCollectionViewFlowLayout: UICollectionViewFlowLayout {
private var topMostVisibleItem = Int.max
private var bottomMostVisibleItem = -Int.max
private var offset: CGFloat = 0.0
private var visibleAttributes: [UICollectionViewLayoutAttributes]?