Skip to content

Instantly share code, notes, and snippets.

View eerien's full-sized avatar

Changhwan Song eerien

View GitHub Profile
@eerien
eerien / forms.py
Last active February 2, 2023 23:12
Comma Separated Values Form Field for Django. There are CommaSeparatedCharField, CommaSeparatedIntegerField.
from django import forms
from django.core import validators
from django.core.exceptions import ValidationError
class MinLengthValidator(validators.MinLengthValidator):
message = 'Ensure this value has at least %(limit_value)d elements (it has %(show_value)d).'
class MaxLengthValidator(validators.MaxLengthValidator):
message = 'Ensure this value has at most %(limit_value)d elements (it has %(show_value)d).'
@eerien
eerien / insert_bulk_data.sql
Created May 14, 2013 02:22
INSERT bulk data procedure.
DECLARE
BEGIN
FOR i IN 1..100000 LOOP
INSERT INTO T1 VALUES (i);
END LOOP;
COMMIT;
END;
/
@eerien
eerien / pstack
Created April 16, 2013 02:16
Print multi thread process backtrace.
#!/bin/sh
if test $# -ne 1; then
echo "Usage: `basename $0 .sh` <process-id>" 1>&2
exit 1
fi
if test ! -r /proc/$1; then
echo "Process $1 not found." 1>&2
exit 1