Skip to content

Instantly share code, notes, and snippets.

View alukach's full-sized avatar
🍊

Anthony Lukach alukach

🍊
View GitHub Profile
@alukach
alukach / docker-tips.md
Last active February 12, 2020 21:32
Docker Cheatsheet

Docker Cheatsheet

Glossary

Container
Single unit of computing.
Task
@alukach
alukach / Myanmar.html
Created June 1, 2017 18:42
A quick test of a computers ability to view Myanmar set of Unicode characters.
<!DOCTYPE html>
<html class="client-nojs" lang="en" dir="ltr">
<head>
<meta charset="UTF-8"/>
<title>S'gaw Karen Script - Wikipedia</title>
</head>
<body>
<h3><span class="mw-headline" id="Blocks">Blocks</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=S%27gaw_Karen_Script&amp;action=edit&amp;section=2" title="Edit section: Blocks">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<div role="note" class="hatnote navigation-not-searchable">See also: <a href="/wiki/Myanmar_(Unicode_block)" title="Myanmar (Unicode block)">Myanmar (Unicode block)</a>, <a href="/wiki/Myanmar_Extended-A" title="Myanmar Extended-A">Myanmar Extended-A (Unicode block)</a>, and <a href="/wiki/Myanmar_Extended-B" title="Myanmar Extended-B">Myanmar Extended-B (Unicode block)</a></div>
<p>The Unicode blocks for Burmese, called Myanmar, are U+1000–U+109F, U+AA60–U+AA7B, and U+A9E0-U+A9FF.</p>
@alukach
alukach / threading.py
Created May 11, 2017 20:52
Threading Context Manager
from multiprocessing import cpu_count
import threading
import queue
import logging
logger = logging.getLogger(__name__)
class ThreadQueue(object):
@alukach
alukach / drf-custom-token-auth.py
Last active April 6, 2017 02:42
A custom token authentication system for DRF.
#
# Token Manager
# https://docs.djangoproject.com/en/1.10/topics/signing/
#
from django.core import signing
from django.contrib.auth import get_user_model
class TemporaryApiToken():
"""
@alukach
alukach / test.py
Created June 9, 2016 15:28
A test script to demonstrate that Twisted was locking up after 30k file deletions
import sys
from twisted.internet import inotify, reactor, threads
from twisted.python import filepath
# Resources:
# Introduction to Deferreds:
# http://twisted.readthedocs.io/en/twisted-16.1.1/core/howto/defer-intro.html
# Returning Deferreds from synchronous functions:
# https://twistedmatrix.com/documents/current/core/howto/gendefer.html#returning-deferreds-from-synchronous-functions
@alukach
alukach / twisted_deferreds_callback_example.py
Last active June 1, 2016 23:16
An example of using Twisted to write asynchronous code while using blocking functions.
from twisted.internet import inotify, reactor, threads
from twisted.python import filepath
# Resources:
# Introduction to Deferreds:
# http://twisted.readthedocs.io/en/twisted-16.1.1/core/howto/defer-intro.html
# Returning Deferreds from synchronous functions:
# https://twistedmatrix.com/documents/current/core/howto/gendefer.html#returning-deferreds-from-synchronous-functions
# addCallbacks Docs:
# https://twistedmatrix.com/documents/16.1.1/api/twisted.internet.defer.Deferred.html#addCallbacks
@alukach
alukach / serializer_mixins.py
Created April 8, 2016 16:30
A ModelSerializer that allows for optional fields to be added to a serializer. These fields only appear when they are referred to by name with a `include` GET parameter. Additionally, a user can provide a `fields` GET parameter to limit which fields are serialized for output.
from rest_framework import serializers
class DynamicFieldsModelSerializer(serializers.ModelSerializer):
"""
A ModelSerializer that allows for optional fields to be added to a
serializer. These fields only appear when they are referred to by
name with a `include` GET parameter.
Additionally, a user can provide a `fields` GET parameter to limit
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alukach
alukach / union1.geojson
Created April 15, 2015 01:13
Union Test Files
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alukach
alukach / dogparks.geojson
Last active August 29, 2015 14:14
Calgary Off-Leash Parks and Natural Areas
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.