Skip to content

Instantly share code, notes, and snippets.

View apinsard's full-sized avatar

Antoine Pinsard apinsard

View GitHub Profile
@apinsard
apinsard / Queryset_result_cache_test.py
Last active October 11, 2022 12:17
Example of QuerySet._result_cache not set when calling QuerySet.__repr__
>>> a = Tag.objects.filter(pk=1)
>>> a._result_cache
>>> a
<QuerySet [<Tag: Test>]>
>>> a._result_cache
>>> for b in a:
... pass
...
>>> a._result_cache
[<Tag: Test>]
@apinsard
apinsard / django-project.gitignore
Created July 6, 2016 09:44
Default .gitignore file for django projects
*.py[co]
*.sw[po]
*~
*.log
*.mo
/secrets.json
/media/
/tmp/
/.sass-cache/
Playground tony # rc-service dhcpcd stop && echo "$?"
dhcpcd | * WARNING: dhcpcd is already stopped
0
Playground tony # rc-service dhcpcd start && echo "$?"
dhcpcd | * Starting DHCP Client Daemon ...
[ ok ] |
0
Playground tony # rc-service dhcpcd stop && echo "$?"
dhcpcd | * Stopping DHCP Client Daemon ...
[ ok ] |
@apinsard
apinsard / stdin
Created August 17, 2015 17:43
stdin
Runlevel: default
sshd [ started ]
netmount [ started ]
mysql [ started ]
postgresql-9.4 [ started ]
apache2 [ started ]
dbus [ started ]
cupsd [ started ]
dhcpcd [ stopped ]
distccd [ started ]
@apinsard
apinsard / stdin
Created July 1, 2015 19:55
stdin
[ 354.254286] NVRM: NVIDIA init module failed!
[ 354.320949] NVRM: The NVIDIA GeForce 210 GPU installed in this system is
NVRM: supported through the NVIDIA 340.xx Legacy drivers. Please
NVRM: visit http://www.nvidia.com/object/unix.html for more
NVRM: information. The 349.16 NVIDIA driver will ignore
NVRM: this GPU. Continuing probe...
[ 354.320970] NVRM: No NVIDIA graphics adapter found!
[ 354.321112] NVRM: NVIDIA init module failed!
[ 354.394036] NVRM: The NVIDIA GeForce 210 GPU installed in this system is
NVRM: supported through the NVIDIA 340.xx Legacy drivers. Please
@apinsard
apinsard / stdin
Created June 20, 2015 08:29
stdin
2015-06-20 10:28:25,709 WARNING init_log:93 Starting Qtile
2015-06-20 10:28:26,851 ERROR make_qtile:109 Error while reading config file
Traceback (most recent call last):
File "/usr/bin/qtile-3.3", line 107, in make_qtile
c = confreader.File(options.configfile, is_restart=options.no_spawn)
File "/usr/lib64/python3.3/site-packages/libqtile/confreader.py", line 46, in __init__
from .resources import default_config
File "/usr/lib64/python3.3/site-packages/libqtile/resources/default_config.py", line 27, in <module>
from libqtile.config import Key, Screen, Group, Drag, Click
File "/usr/lib64/python3.3/site-packages/libqtile/config.py", line 35, in <module>
@apinsard
apinsard / tmp.py
Created June 14, 2015 17:47
tmp.py
class Degree(models.Model):
class Meta:
ordering = ['-popularity']
order_with_respect_to = 'subcategories'
name = models.CharField(unique=True, max_length=20)
description = models.TextField(blank=True)
popularity = models.PositiveIntegerField(default=0)
alias_of = models.ForeignKey('self', related_name='synonyms', blank=True,
@apinsard
apinsard / stdin
Created June 6, 2015 08:08
stdin
Available fontconfig .conf files (* is enabled):
[1] 09-texlive.conf
[2] 10-autohint.conf
[3] 10-no-sub-pixel.conf
[4] 10-scale-bitmap-fonts.conf *
[5] 10-sub-pixel-bgr.conf
[6] 10-sub-pixel-rgb.conf
[7] 10-sub-pixel-vbgr.conf
[8] 10-sub-pixel-vrgb.conf
[9] 10-unhinted.conf
@apinsard
apinsard / stdin
Created June 6, 2015 08:06
stdin
This is XeTeX, Version 3.14159265-2.6-0.99991 (TeX Live 2014) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
(./cv_10.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 4 languages loaded.
(./friggeri-cv.cls
Document Class: friggeri-cv 2012/04/30 CV class
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
@apinsard
apinsard / sample.py
Created May 31, 2015 17:50
sample.py
class FlagsSet(object):
"""A bit field wrapper.
See: http://en.wikipedia.org/wiki/Bit_field if you don't know what a
bit field is.
"""
def __init__(self, flags=0, max_nb_flags=64):
"""Create a flags set with the given flags already set."""
assert type(flags) is int