Skip to content

Instantly share code, notes, and snippets.

expregu = "("
for i in range(1, 20000):
expregu += str(i) + "|"
expregu += ")"
comando = "grep -Eo '%s' /etc/passwd" % expregu
fi = open("/home/dc/expregu1.sh", "w")
fi.write(comando)
fi.close()
@clemente
clemente / gist:221d31f8fd49d95473231b8257cad9c5
Created August 21, 2020 16:48
elasticsearch errors, OOM
[2020-08-13T14:58:30,393][WARN ][o.e.m.j.JvmGcMonitorService] [abXmLud] [gc][21145619] overhead, spent [17.2s] collecting in the last [17.3s]
[2020-08-13T14:58:47,743][INFO ][o.e.m.j.JvmGcMonitorService] [abXmLud] [gc][old][21145620][3543761] duration [17.2s], collections [3]/[17.3s], total [17.2s]/[1.8d], memory [3.9gb]->[3.9gb]/[3.9gb], all_pools {[young] [266.2mb]->[266.2mb]/[266.2mb]}{[survivor] [32.2mb]->[33mb]/[33.2mb]}{[old] [3.6gb]->[3.6gb]/[3.6gb]}
[2020-08-13T14:58:47,743][WARN ][o.e.m.j.JvmGcMonitorService] [abXmLud] [gc][21145620] overhead, spent [17.2s] collecting in the last [17.3s]
[2020-08-13T14:59:13,020][INFO ][o.e.m.j.JvmGcMonitorService] [abXmLud] [gc][old][21145621][3543765] duration [25.1s], collections [4]/[25.2s], total [25.1s]/[1.8d], memory [3.9gb]->[3.9gb]/[3.9gb], all_pools {[young] [266.2mb]->[266.2mb]/[266.2mb]}{[survivor] [33mb]->[32.2mb]/[33.2mb]}{[old] [3.6gb]->[3.6gb]/[3.6gb]}
[2020-08-13T14:59:13,020][WARN ][o.e.m.j.JvmGcMonitorService] [abXmLud] [gc][21145621] overhead, spe
@clemente
clemente / gist:640cb81424d2805406f013baece0e0fd
Created July 23, 2020 21:53
edx-platform/lms/djangoapps/grades/management/commands/generate_csv_grade_reports.py
# -*- coding: utf-8 -*-
"""
Command to automatically produce the grade reports as CSV files.
The reports and the destination location are the same as the "Generate grade report" button
which is available in the instructor dashboard.
The files must be retrieved manually from the instructor dashboard.
Note: this is a prototype, a proof of concept. Code is still ugly. When we check that the
approach works as expected, we'll work on the elegant solution to be sent upstream.
"""
@clemente
clemente / gist:4d0a3dfd0337e4259a12fda6633978ae
Created August 12, 2019 12:09
pipdeptree of Ocim requirements, from my devstack
ansible==2.3.2.0
- jinja2 [required: Any, installed: 2.10.1]
- MarkupSafe [required: >=0.23, installed: 1.1.1]
- paramiko [required: Any, installed: 2.4.0]
- bcrypt [required: >=3.1.3, installed: 3.1.4]
- cffi [required: >=1.1, installed: 1.12.3]
- pycparser [required: Any, installed: 2.19]
- six [required: >=1.4.1, installed: 1.12.0]
- cryptography [required: >=1.5, installed: 2.7]
- asn1crypto [required: >=0.21.0, installed: 0.24.0]
@clemente
clemente / gist:96d091bcd81f8816b7c5f288087e4268
Created September 5, 2018 22:12
Runtime error in Docker image
Traceback (most recent call last):
File "/edx/app/edxapp/edx-platform/manage.py", line 118, in <module>
startup.run()
File "/edx/app/edxapp/edx-platform/lms/startup.py", line 19, in run
django.setup()
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models()
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
@clemente
clemente / gist:c4e0ebc28213e0aa41c9d87fd6c693e5
Last active October 10, 2017 10:40
Command to connect to openedx and auto-start screen with LMS and forum inside
A command I use to reconnect to openedx vagrant box every time vagrant hangs (that is, every time I hibernate and resume my computer; https://www.virtualbox.org/ticket/14374 )
It also opens some things inside the VM and auto-starts LMS and forum.
Still testing, might not work 100%.
```
function vagrant-reconnect-after-hang () {
vagrant halt && vagrant up && vagrant ssh -c "screen -AmdS test2; screen -S test2 -p 0 -X stuff $'sudo su edxapp\rpaver devstack lms\r'; screen -S test2 -X screen; screen -S test2 -p 1 -X stuff $'sudo su forum\rbundle install && ruby app.rb -p 18080\r'; screen -S test2 -X screen; screen -S test2 -p 2 -X stuff $'sudo su edxapp\rcd ../themes\r'; screen -S test2 -r"
}
```