Note: these instructions are for pre-Sierra MacOS. Sierra (10.12) and newer users see https://gist.github.com/gravitylow/fb595186ce6068537a6e9da6d8b5b96d by @gravitylow
If you are getting this in gdb on OSX while trying to run a program:
from django.core import serializers | |
import os | |
def loaddata(fixture_name, apps, ignorenonexistent=True): | |
""" | |
Loads migrations that work at current state of a model, in constrast to | |
`loaddata` which requires a fixture to have data matching the fields | |
defined in `models.py`. |
import os | |
import logging | |
from django.core import serializers | |
LOGGER = logging.getLogger(__name__) | |
def load_fixture(app, fixture, ignorenonexistent=True): | |
""" |
<?xml version="1.1" encoding="UTF-8"?> | |
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd"> | |
<!-- | |
Data generated Wed Mar 23 01:35:41 2022 | |
Generated by kluchrtoxml_64 build 203 | |
--> | |
<!--Last edited by Ukelele version 351 on 2022-03-23 at 01:45 (GMT+8)--> |
Note: these instructions are for pre-Sierra MacOS. Sierra (10.12) and newer users see https://gist.github.com/gravitylow/fb595186ce6068537a6e9da6d8b5b96d by @gravitylow
If you are getting this in gdb on OSX while trying to run a program:
foxdot-cli.py
in the same directory as the FoxDot installaton (in case you're using virtualenv
, otherwise comment from lines 5 to 7)foxdot-mode.el
to ~/.emacs.d/lisp
(defvar foxdot-cli-path "/path/to/foxdot-cli/")
in your ~/.emacs
fileM-x load-library
and complete with foxdot-mode
C-c C-f
or M-x foxdot-start
to startC-c C-e
or M-x foxdot-execute
to evaluate a line or a block of codepackage main | |
import ( | |
"strings" | |
) | |
func main() { | |
strings.HasPrefix("foobar", "foo") // true | |
} |
import hashlib | |
from functools import wraps | |
from django.core.cache import cache | |
from django.utils.encoding import force_text, force_bytes | |
def cache_memoize( | |
timeout, | |
prefix='', |
from __future__ import print_function | |
try: | |
import msvcrt | |
def key_pressed(): | |
return msvcrt.kbhit() | |
def read_key(): | |
key = msvcrt.getch() |
# An example to get the remaining rate limit using the Github GraphQL API. | |
import requests | |
headers = {"Authorization": "Bearer YOUR API KEY"} | |
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section. | |
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers) | |
if request.status_code == 200: |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.