Skip to content

Instantly share code, notes, and snippets.

View metaperl's full-sized avatar

Structure and Interpretation of Computer Programs metaperl

View GitHub Profile
@metaperl
metaperl / gist:11b79ef5e46590ba905c944d10dc963c
Created April 12, 2018 08:27
AttributeError: '_thread._local' object has no attribute '_pydal_connection_140103876850296_30686'
Traceback (most recent call last):
File "/home/schemelab/install/miniconda3/lib/python3.6/site-packages/pyrogram/client/client.py", line 707, in update_worker
{i.id: i for i in update[2]}
File "/home/schemelab/prg/surgetrader/src/lib/telegram.py", line 78, in update_handler
lib.buy.process(ini, [market])
File "/home/schemelab/prg/surgetrader/src/lib/buy.py", line 412, in process
buycoin(config_file, user_config, exchange, top_coins)
File "/home/schemelab/prg/surgetrader/src/lib/buy.py", line 253, in buycoin
_buycoin(config_file, user_config, exchange, market, avail)
File "/home/schemelab/prg/surgetrader/src/lib/buy.py", line 242, in _buycoin
The apache2 configtest failed. ... (warning).
Output of config test was:
apache2: Syntax error on line 244 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/wsgi.load: Cannot load /usr/lib/apache2/m\
odules/mod_wsgi.so into server: /usr/lib/apache2/modules/mod_wsgi.so: cannot open shared object file: No such file or directory
Action 'configtest' failed.
schemelab@metta:~$ sudo apt install emacs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
aptitude : Depends: libboost-iostreams1.74.0 (>= 1.74.0) but it is not going to be installed
Depends: libcwidget4 (>= 0.5.18-1) but it is not going to be installed
Depends: libxapian30 (>= 1.4.17~) but 1.4.3-2+deb9u3 is to be installed
emacs : Depends: emacs-gtk (>= 1:27.1) but it is not going to be installed or
@metaperl
metaperl / audit_mixin.py
Last active February 14, 2022 11:28
generic audit log for SQLAlchemy models, inspired by https://gist.github.com/ngse/c20058116b8044c65d3fbceda3fdf423
# Inspired by the flask-specific https://gist.github.com/ngse/c20058116b8044c65d3fbceda3fdf423
# This is generic and should work with any web framework and even command-line.
# Implement by using AuditableMixin in your model class declarations
# Usage for the [Reahl web app framework](http://reahl.org) below:
# ---------------------------------------------------------------
# import lib.audit_mixin
@metaperl
metaperl / mt5_pending_order.py
Created June 19, 2020 20:22
Create pending orders in Python MT5 via pymt5adapter
import MetaTrader5 as mt5
import pymt5adapter
from pymt5adapter.order import Order
from pymt5adapter.symbol import Symbol
class MySymbol(Symbol):
def pips(self, amount):
return amount * 10 * self.point
@metaperl
metaperl / mt4_python_trade.py
Created April 2, 2020 16:03
Open MT4 trade from Python
from DWX_ZeroMQ_Connector_v2_0_1_RC8 import DWX_ZeroMQ_Connector
OP_BUY = 0
OP_SELL = 1
OP_BUYLIMIT = 2
OP_SELLLIMIT = 3
OP_BUYSTOP = 4
OP_SELLSTOP = 5
zmq = DWX_ZeroMQ_Connector()
@metaperl
metaperl / emacs-table.txt
Created July 8, 2021 09:59
how to get an emacs table to fill width?
+---------------+---------------+---------------+---------------+
| Action/Speech | Feeling Then | Feeling from List | Need |
| | | | |
+---------------+---------------+---------------+---------------+
| | | | |
+---------------+---------------+---------------+---------------+
| | | | |
+---------------+---------------+---------------+---------------+
| | | | |
In GNU Emacs 27.1 (build 1, i686-w64-mingw32)
of 2020-08-21 built on CIRROCUMULUS
Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.19042
System Description: Microsoft Windows 10 Home (v10.0.2009.19042.1052)
@metaperl
metaperl / gist:d13f92ed82553e06ed066c61fad02426
Created June 29, 2021 08:15
desktop-create-buffer yields wrong-type-argument stringp nil
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
file-name-case-insensitive-p(nil)
dired-omit-case-fold-p(nil)
dired-omit-expunge()
dired-omit-mode(1)
desktop-create-buffer(208 "c:/Users/thequ/AppData/Roaming/.emacs.el" ".emacs.el" emacs-lisp-mode (eldoc-mode override-global-mode global-auto-revert-mode flx-ido-mode dired-omit-mode auto-complete-mode) 35 (1 nil) nil nil ((buffer-display-time 24790 5102 984406 0) (buffer-file-coding-system . undecided-dos)) ((mark-ring (36))))
eval-buffer(#<buffer *load*> nil "c:/Users/thequ/AppData/Roaming/.emacs.d/.emacs.des..." nil t) ; Reading at buffer position 10006
load-with-code-conversion("c:/Users/thequ/AppData/Roaming/.emacs.d/.emacs.des..." "c:/Users/thequ/AppData/Roaming/.emacs.d/.emacs.des..." t t)
load("c:/Users/thequ/AppData/Roaming/.emacs.d/.emacs.des..." t t t)
desktop-read()
@metaperl
metaperl / execution_failure.sh
Created July 4, 2020 11:04
Failure of execution from shell
(base) C:\cygwin64\home\terre\prg\import-hell-with-anaconda-python>python bin\rule_cli.py
The PYTHON PATH = ['C:\\cygwin64\\home\\terre\\prg\\import-hell-with-anaconda-python\\src', 'C:\\cygwin64\\home\\terre\\prg\\import-hell-with-anaconda-python\\bin', 'C:\\cygwin64\\home\\terre\\prg\\telegram-autotrader\\src', 'C:\\cygwin64\\home\\terre\\prg\\dwx-zeromq-connector\\v2.0.1\\python\\api', 'C:\\Users\\terre\\anaconda3\\python37.zip', 'C:\\Users\\terre\\anaconda3\\DLLs', 'C:\\Users\\terre\\anaconda3\\lib', 'C:\\Users\\terre\\anaconda3', 'C:\\Users\\terre\\anaconda3\\lib\\site-packages', 'C:\\Users\\terre\\anaconda3\\lib\\site-packages\\win32', 'C:\\Users\\terre\\anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\Users\\terre\\anaconda3\\lib\\site-packages\\Pythonwin']
Traceback (most recent call last):
File "bin\rule_cli.py", line 14, in <module>
import rule.myrule
ModuleNotFoundError: No module named 'rule.myrule'
(base) C:\cygwin64\home\terre\prg\import-hell-with-anaconda-python>