Skip to content

Instantly share code, notes, and snippets.

View haroldrandom's full-sized avatar
🐭
chill and unwind

Harold Ran haroldrandom

🐭
chill and unwind
View GitHub Profile
@haroldrandom
haroldrandom / instance_vs_class_eval.rb
Created February 24, 2018 17:02
Difference between instance_eval and class_eval
#!/usr/bin/env ruby
# encoding: UTF-8
class RackServer
def options
#puts "RackServer: #{self} #{__LINE__}"
@options ||= parse_options(ARGV)
end
@haroldrandom
haroldrandom / setting.py
Created October 25, 2018 07:41
Setup SQL query logging in Django
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
}
},
'loggers': {
@haroldrandom
haroldrandom / django-startcelery-command.py
Created January 11, 2019 06:05
Django custom command for autorestart celery workers
import os
import time
import shlex
from datetime import datetime
from django.core.management.base import BaseCommand
from django.conf import settings
from watchdog.observers import Observer
from watchdog.tricks import AutoRestartTrick