Skip to content

Instantly share code, notes, and snippets.

Avatar
🦍
hu!

Maciej Jankowski maciejjankowski

🦍
hu!
View GitHub Profile
View pg_restore.sh
docker cp db_backup_file docker_hash:/tmp/db_backup_file
pg_restore --no-privileges \
--no-owner \
--superuser=postgres \
--disable-triggers \
--clean \
-d db_name \
/tmp/db_backup_file
@maciejjankowski
maciejjankowski / settings.py
Created Feb 22, 2021
Logging raw SQL to the console in Django
View settings.py
LOGGING = {
'version': 1,
'filters': {
'require_debug_true': {
'()': 'django.utils.log.RequireDebugTrue',
}
},
'handlers': {
'console': {
'level': 'DEBUG',
View gist:c7f9b7848feae5b2a86c7d770e7a185a
find . -path ./venv -prune -false -o -name '*.py' -exec tail -n +1 {} + > ../output.txt
@maciejjankowski
maciejjankowski / config.txt
Created Nov 3, 2020
raspberry pi waveshare 7 inch lcd display
View config.txt
max_usb_current=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt 1024 600 60 6 0 0 0
hdmi_drive=1
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
@maciejjankowski
maciejjankowski / bookmarklet.js
Last active May 12, 2020
github bookmark bookmarklet
View bookmarklet.js
const month = new Date().toDateString().split(' ')[1];
const year = new Date().toDateString().split(' ')[3];
if (location.href.indexOf(`github.com/maciejjankowski/${year}/wiki`) > -1) {
const searchToken = '# Worth checking:\n';
const textarea = document.querySelector('#gollum-editor-body');
const textIndex = textarea.value.indexOf(searchToken);
const textLength = searchToken.length;
textarea.value =
textarea.value.slice(0, textIndex + textLength) +
prompt() +
@maciejjankowski
maciejjankowski / bookmarklet.js
Created Sep 27, 2019
github bookmarking bookmarklet
View bookmarklet.js
const month = new Date().toDateString().split(' ')[1];
const year = new Date().toDateString().split(' ')[3];
if (location.href.indexOf(`github.com/maciejjankowski/${year}/wiki`) > -1) {
const searchToken = '# Worth checking:\n';
const textarea = document.querySelector('#gollum-editor-body');
const textIndex = textarea.value.indexOf(searchToken);
const textLength = searchToken.length;
textarea.value =
textarea.value.slice(0, textIndex + textLength) +
@maciejjankowski
maciejjankowski / microgranny sox convert sample rate.sh
Last active May 15, 2019
convert sample rate command line sox
View microgranny sox convert sample rate.sh
for file in *
do
if [ ! -d "$file" ] && [ ! "$file" == 'convert.sh' ] ; then
sox $file -b 16 -c 1 -r 48k "converted/$file"
fi
done
@maciejjankowski
maciejjankowski / refactorings.py
Last active Jan 9, 2019
Refactoring exercises
View refactorings.py
# https://github.com/RefactoringGuru/refactoring-examples/tree/master/simple/python
# 1
def disabilityAmount():
if seniority < 2:
return 0
if monthsDisabled > 12:
return 0
if isPartTime:
return 0