Skip to content

Instantly share code, notes, and snippets.

View jeromecc's full-sized avatar
🤖
Building bots for my Riot / Matrix server

jeromecc jeromecc

🤖
Building bots for my Riot / Matrix server
View GitHub Profile
@jeromecc
jeromecc / multitask.py
Created December 6, 2020 22:18 — forked from kkirsanov/multitask.py
run multiple django managememnt commands simultaneously
# coding=utf8
import logging
import threading
import time
from django.core.management import call_command
from django.core.management.base import BaseCommand
logger = logging.getLogger('multirunner')
@jeromecc
jeromecc / views.py
Created September 11, 2019 17:13 — forked from alee/views.py
Django Discourse SSO endpoint adapted from https://meta.discourse.org/t/sso-example-for-django/14258 - depends on settings.py DISCOURSE_BASE_URL and DISCOURSE_SSO_SECRET
import base64
import hmac
import hashlib
from urllib import parse
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseBadRequest, HttpResponseRedirect
from django.conf import settings
@login_required
@jeromecc
jeromecc / django_delete_database_table.md
Last active March 15, 2019 22:03
Django 2.0 Delete database table after removing an app

First: Remove references in the code

remove app_to_remove from settings.INSTALLED_APPS
remove other references in urls.py or other places

Second: Clean the database

Create an empty migration for your django-project:

manage.py makemigrations your_django_project --empty

@jeromecc
jeromecc / README.md
Created March 13, 2019 15:26 — forked from gdamjan/README.md
Setup for an easy to use, simple reverse http tunnels with nginx and ssh. It's that simple there's no authentication at all. The end result, a single ssh command invocation gives you a public url for your web app hosted on your laptop.

What

A lot of times you are developing a web application on your own laptop or home computer and would like to demo it to the public. Most of those times you are behind a router/firewall and you don't have a public IP address. Instead of configuring routers (often not possible), this solution gives you a public URL that's reverse tunnelled via ssh to your laptop.

Because of the relaxation of the sshd setup, it's best used on a dedicated virtual machine just for this (an Amazon micro instance for example).

Requirements

@jeromecc
jeromecc / gameofthrones_8k-2018.txt
Created February 2, 2019 12:18
Use EFF diceware lists to generate passwords with keepass
Passwords of Westeros
A Game of Thrones-inspired Wordlist
This wordlist was created by identifying the unique words in some of the most popular user-created pages at FANDOM's gameofthrones.wikia.com. They are numbered to correspond with three roles of a 20-sided die.
The list was created by the Electronic Frontier Foundation and maybe freely distributed use under the Creative Commons Attribution 3.0 United States license.
Any trademarks within the word list are the property of their respective trademark holders, who are not affiliated with the Electronic Frontier Foundation and do not sponsor or endorse these passwords.
#!/usr/bin/python
import urllib2
import re
import ssl
import sys
# # find generic mirrors
mirrors = urllib2.urlopen('http://www.debian.org/mirror/list')
https = []