- A bit is a BInary digiT. It uses base 2.
- A byte is 8 bits.
- An IPv4 address is 4 bytes (32 bits) long. It is usually expressed in
decimal notation, i.e.
0-255.0-255.0-255.0-255
. - IP addresses comprise 2 parts:
This file contains 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
# Essentially, the reason you're finding this hard to test is because the | |
# business logic is baked into the save_model method - this is effectively a | |
# "fat controller". You want to pull that logic out and give it names. This has | |
# several outcomes: | |
# * it makes your code easier to unit test because you're | |
# not coupled to the form and the admin, and in fact you don't even | |
# need a real expense object here, it could be just a stub. | |
# * it makes code reuse easier - it's rarely a good idea to have | |
# business logic living *only* in an admin method. |
This file contains 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
Acceptance | Login | |
an unauthenticated user | |
TestLoader Failures | |
"before each" hook for "doge/tests/acceptance/foo-test: could not be loaded" ‣ | |
TypeError: Cannot read property 'create' of undefined | |
at assets/test-support.js:22802:36 | |
at Backburner.run (assets/vendor.js:19156:25) | |
at Object.run (assets/vendor.js:42590:27) | |
at _default.createApplication (assets/test-support.js:22801:27) | |
at _default.setupContext (assets/test-support.js:22781:110) |
This file contains 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 6c22c5f613adb15b9fe4d31ee70567d05cf127c8 mon sep 17 00:00:00 2001 | |
from: ahtn <ahtn@users.noreply.github.com> | |
Date: Sun, 18 Oct 2015 17:25:46 +1000 | |
Subject: [PATCH] Adds oneshot layer and oneshot tap toggling | |
* Adds ACTION_LAYER_ONESHOT | |
* Adds ONESHOT_TAP_TOGGLE | |
* Mentions sticky keys in the docs on oneshot. | |
--- | |
tmk_core/doc/keymap.md | 18 +- |
This file contains 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
This is a quick test of the gist-vim functionality. | |
More Booyah. |
This file contains 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
# I need the best idiomatic way of getting a map of users and their points. | |
# The values/annotation combo *almost* gives me what I want, but doesn't return | |
# full user objects, only their ids. | |
>>> Points.objects.values('user').annotate(total_points=Sum('amount')) | |
[{'total_points': 40, 'user': 1}, {'total_points': 30, 'user': 2}] | |
# I've opted for something like this, instead: | |
Points.objects.users().annotate(total_points=Sum('points__amount')) |
This file contains 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
try: | |
from south.modelsinspector import add_introspection_rules | |
except ImportError: | |
add_introspection_rules = False | |
if add_introspection_rules: | |
add_introspection_rules([ | |
( | |
[UserField], | |
[], |
This file contains 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.db.models import ForeignKey | |
from django.contrib.auth.models import User | |
import threadlocals | |
class UserField(ForeignKey): | |
""" UserField | |
By defaults, foreign key to User; null=True, blank=True |
This file contains 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
Feature: Store information about achievements # achievements.feature:1 | |
In order to manage achievements # achievements.feature:3 | |
As a programmer # achievements.feature:4 | |
I want to model them using the Django ORM # achievements.feature:5 | |
Scenario: Creating simple achievements # achievements.feature:7 | |
Given that I have the following achievement data: # achievement-steps.py:29 | |
| name | teaser | description | | |
| Bronze Star | The bronze award | This is the third rank | | |
| Silver Star | The silver award | This is the second rank | |
This file contains 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
cleanup () { | |
find ./ -name '*~' -or -name '*.pyc' -or -name '#*#' -or -name '.*~' -or -name '.#*' | xargs rm -f | |
clear | |
} | |
# The previous cleanup function is potentially dangerous in an environment where you could have filenames with spaces. | |
# The safest pattern when using the find... xargs combo is to use null-terminators for filenames, i.e. | |
`find ... -print0 | xargs -0 ...`: | |
cleanup () { |
NewerOlder