Skip to content

Instantly share code, notes, and snippets.


Theodore Keloglou sirodoht

View GitHub Profile
sirodoht / django-csrf.js
Created Nov 7, 2017
Get CSRF token from Django HTML templates with vanilla JS
View django-csrf.js
function getCsrf() {
var inputElems = document.querySelectorAll('input');
var csrfToken = '';
for (i = 0; i < inputElems.length; ++i) {
if (inputElems[i].name === 'csrfmiddlewaretoken') {
csrfToken = inputElems[i].value;
return csrfToken;
sirodoht /
Last active Jul 24, 2020
How to migrate Django from SQLite to PostgreSQL

How to migrate Django from SQLite to PostgreSQL

Dump existing data:

python3 dumpdata > datadump.json

Change to Postgres backend.

Make sure you can connect on PostgreSQL. Then:

sirodoht /
Last active May 31, 2020
Dokku config commands
# config with restart
dokku config:set mataroa SECRET_KEY=''
# config no restart
dokku config:set --no-restart mataroa EMAIL_HOST_USER=''
dokku config:set --no-restart mataroa EMAIL_HOST_PASSWORD=''
# run command
dokku run mataroa python createsuperuser --email --username sirodoht
sirodoht / vscode.json
Last active May 20, 2020
VSCode settings JSON configuration
View vscode.json
"window.zoomLevel": 0,
"window.newWindowDimensions": "maximized",
"window.restoreWindows": "none",
"editor.cursorStyle": "block",
"editor.dragAndDrop": false,
"editor.minimap.size": "fill",
"editor.minimap.showSlider": "always",
"editor.renderWhitespace": "selection",
"editor.renameOnType": false,
sirodoht / lighter.css
Created May 18, 2020
new.css lite version without fonts and minification
View lighter.css
:root {
--text-color: #1a1a1a;
--light-grey-color: #f6f8fa;
--grey-color: #e5e7eb;
--link-color: #0070f3;
--link-accent-color: #0366d6;
--light-cyan-color: #79ffe1;
--dark-cyan-color: #0c4047;
sirodoht / index.html
Last active May 13, 2020
Basic HTML/CSS boilerplate with Normalize.css
View index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="main.css">

Textmate default settings

Exclude files matching


Include files matching

View vscode-keybindings.json
// Place your key bindings in this file to override the defaultsauto[]
"key": "cmd+k i",
"command": "workbench.files.action.collapseExplorerFolders"
"key": "ctrl+down",
"command": "scrollLineDown",
"when": "textInputFocus"
defaults write org.p0deje.Maccy hotKey control+command+c
defaults write org.p0deje.Maccy historySize 50
defaults write org.p0deje.Maccy popupPosition center
You can’t perform that action at this time.