This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from django.contrib.flatpages.models import FlatPage | |
# Note: we are renaming the original Admin and Form as we import them! | |
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld | |
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld | |
from django import forms | |
from django_summernote.widgets import SummernoteWidget | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find -E . -regex '.*\.(jpg|png)' -exec identify {} \; | cut -d ' ' -f 3 | sort -nr | uniq -c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
import psutil | |
import os | |
from datetime import datetime | |
def precise_repeat(f, interval=1.0, run=False): | |
delay = interval - (time.time() % interval) | |
threading.Timer(delay, precise_repeat, (f, interval, True)).start() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Dict <-> String parser for NICE - KOREA INFORMATION SERVICE (sigh) | |
# | |
# [email protected] | |
# | |
from itertools import izip | |
def encode(d): | |
res = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding:utf-8 -*- | |
# Park Hyunwoo <[email protected]> | |
# | |
# You can download ssl-cert-check from http://prefetch.net/articles/checkcertificate.html | |
# | |
import smtplib | |
import email | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An overview of new features and changes in Redis 2.6.x | |
====================================================== | |
* Server side Lua scripting, see http://redis.io/commands/eval | |
* Virtual Memory removed (was deprecated in 2.4) | |
* Hardcoded limits about max number of clients removed. | |
* AOF low level semantics is generally more sane, and especially when used in slaves. | |
* Milliseconds resolution expires, also added new commands with milliseconds precision (PEXPIRE, PTTL, ...). | |
* Better memory usage for "small" lists, ziplists and hashes when fields or values contain small integers. | |
* Read only slaves. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 1. Add preventThreshold in default options and disable preventDefault, about 65L */ | |
that.options = { | |
/* ... */ | |
preventThreshold: 3, | |
/* ... */ | |
onBeforeScrollStart: function (e) { /*e.preventDefault();*/ }, | |
/* ... */ | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Author: cargomedia.ch | |
* | |
* Binds 'touchstart' when binding $.on('click') | |
* and triggers 'click' when 'touchend' happens without 'touchmove' inbetween. | |
*/ | |
(function($) { | |
if (!("ontouchstart" in window)) { | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.cache import cache | |
""" | |
a quick and dirty way to help dull django cache framework | |
Stores another copy of cache value with longer timeout value. | |
So, this will prevent multiple instances create a new copy of cache at same time. | |
Usage : Import this instead of 'django.core.cache' | |
and use your cache-related codes without any changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from webtoon.models import * | |
from django.contrib import admin | |
class AuthorAdmin(admin.ModelAdmin): | |
list_display = ('name', 'desc') | |
admin.site.register(Author, AuthorAdmin) | |
class ComicAdmin(admin.ModelAdmin): | |
list_display = ('title', 'author', 'desc') | |
admin.site.register(Comic, ComicAdmin) |