Skip to content

Instantly share code, notes, and snippets.

Dan Mirsky mirskiy

Block or report user

Report or block mirskiy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mirskiy /
Created Apr 2, 2017
Diff json with vimdiff
# Add this to your .bashrc or .bash_aliases
jdiff() {
# Diff json files faster
# Uses python json.dump with sort_keys=True to fix ordering, then vimdiff
if [[ $# -ne 2 ]]; then
echo "syntax: jdiff file1 file2"
mirskiy /
Created Sep 28, 2016
django tricks
# model new insance or update
self._state.adding == True creating
self._state.adding == False updating
mirskiy / RelatedFieldListFilter.txt
Last active Aug 30, 2016
RelatedFieldListFilter vs RelatedOnlyFieldListFilter
View RelatedFieldListFilter.txt
from the source:
class RelatedOnlyFieldListFilter(RelatedFieldListFilter):
def field_choices(self, field, request, model_admin):
pk_qs = model_admin.get_queryset(request).distinct().values_list('%s__pk' % self.field_path, flat=True)
return field.get_choices(include_blank=False, limit_choices_to={'pk__in': pk_qs})
ex if:
class Author(models.Model):
country = models.ForeignKey('Country')
mirskiy /
Last active Dec 26, 2018
Install tmux 2.2 on Ubuntu 14.04 from source
sudo apt-get update
sudo apt-get install -y libevent-dev libncurses-dev make
tar xvzf tmux-2.2.tar.gz
cd tmux-2.2/
./configure && make
sudo make install
View tmux
# detach others
<prefix> D
# resize
<prefix> :resize[-pane] -(U|D|R|L) [numCells]
1996 sudo hciconfig hci0 up
1997 sudo hidd --connect 00:22:48:86:E6:CA
mirskiy /
Last active Nov 17, 2016
commanding lines
## history
# Quick substitution. Repeat the last command, replacing string1 with string2. Equivalent to ``!!:s/string1/string2/'' (see Modifiers below).
# Swap usage
# display in hex
echo 'test' | hd
You can’t perform that action at this time.