Skip to content

Instantly share code, notes, and snippets.

View maciejjankowski's full-sized avatar
🦍
hu!

Maciej Jankowski maciejjankowski

🦍
hu!
View GitHub Profile
@maciejjankowski
maciejjankowski / config.txt
Last active January 29, 2022 12:37
raspberry pi waveshare 7 inch lcd display
max_usb_current=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt=1024 600 60 6 0 0 0
hdmi_drive=1
@maciejjankowski
maciejjankowski / download table to excel csv.js
Last active December 30, 2021 18:47
download table to excel csv.js. Charset MUST be UTF-16LE - this is the only solution that worked with Excel on Mac
function exportTableToCSV($table, filename) {
var $rows = $table.find('tr:has(td,th)'),
// Temporary delimiter characters unlikely to be typed by keyboard
// This is to avoid accidentally splitting the actual contents
tmpColDelim = String.fromCharCode(11), // vertical tab character
tmpRowDelim = String.fromCharCode(0), // null character
// actual delimiter characters for CSV format
@maciejjankowski
maciejjankowski / disable localhost ssl errors.txt
Created July 7, 2021 14:02
disable localhost ssl errors
edge://flags/#allow-insecure-localhost
@maciejjankowski
maciejjankowski / pg_restore.sh
Created March 24, 2021 12:09
Restore pg_dump data
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 February 22, 2021 15:50
Logging raw SQL to the console in Django
LOGGING = {
'version': 1,
'filters': {
'require_debug_true': {
'()': 'django.utils.log.RequireDebugTrue',
}
},
'handlers': {
'console': {
'level': 'DEBUG',
find . -path ./venv -prune -false -o -name '*.py' -exec tail -n +1 {} + > ../output.txt
<!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>
<!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 08:09
github bookmark bookmarklet
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 September 27, 2019 21:05
github bookmarking bookmarklet
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) +