Skip to content

Instantly share code, notes, and snippets.

View heemayl's full-sized avatar

Readul Hasan Chayan heemayl

View GitHub Profile
@heemayl
heemayl / script.gnp
Last active November 5, 2015 08:48
Basics of GNU Plot
#!/usr/bin/env gnuplot
## We are plotting a time-series data, Time in `HH:MM` is separated by a space with their respective Number, you can think of the number as the Number of Users of an Application. Here is a snippet of the input file "input.txt" (remove the hashes, of course):
#12:00 2345
#12:15 5084
#12:30 2490
#12:45 3490
#13:00 4567
#13:15 4240
@heemayl
heemayl / django_model_instance_clone_on_update.py
Created October 23, 2019 12:02
Django : clone model instance on update via a descriptor (used as a decorator on `save` method)
class clone_on_update(object):
"""Descriptor to clone the model instance when any field
is updated. This is meant to be set as a decorator on `save`
method of the model.
Initialization Args:
- `condition` (str/callable) [Optional] (default: None)
- `active_status_field` (str) [Optional] (default: None)
- `update_one_to_one` (bool) [Optional] (default: True)