Skip to content

Instantly share code, notes, and snippets.

View dkdndes's full-sized avatar

PR dkdndes

View GitHub Profile

API Gateway Definition

An API gateway is defined as an access management that is placed in front of an API (application programming interface) and is the single point of access for defined back-end APIs or even microservices (which can be internal or external).

Sitting in front of the APIs, the API Gateway acts as a "protector" that

a) enforces security and 

b) allows scalability and 
"""Utils for the media files."""
from django.conf import settings
from django.contrib.sites.models import Site
from django.utils.functional import lazy
def generate_abs_media_url():
"""Return the absolute media URL.
@dkdndes
dkdndes / ascii_art_utf8
Created January 18, 2021 19:18
Ascii Art in one line (utf8)
©️ Copyright Sign
®️ Registered Sign
‼️ Double Exclamation Mark
⁉️ Exclamation Question Mark
™️ Trade Mark Sign
ℹ️ Information Source
↔️ Left Right Arrow
↕️ Up Down Arrow
↖️ North West Arrow
↗️ North East Arrow
A-OLs - Administrators On-Line
AAMOF - As A Matter Of Fact
ADN - Any Day Now
AFAIC - As Far As I'm Concerned
AFAIK - As Far As I Know
AFAIR - As Far As I Remember
AFJ - April Fools Joke
AFK - Away From the Keyboard
AISI - As I See It
ANFAWFOS - And Now For A Word From Our Sponsor
#!/bin/sh
# check if pyenv is available
# edit: fixed redirect issue in earlier version
if which pyenv >/dev/null 2>&1; then
# assumes default location of brew in `/usr/local/bin/brew`
/usr/bin/env PATH="${PATH//$(pyenv root)\/shims:/}" /usr/local/bin/brew "$@"
else
/usr/local/bin/brew "$@"
fi
# users = queryset.values_list('group', 'username').distinct()
users = [('admin', 'root'), ('group1', 'andy'), ('group1', 'tim')]
grouped_users = reduce(lambda d, (k, v): dict(d, **{k: d.get(k, [])+[v]}), users, {})
print grouped_users # {'admin': ['root'], 'group1': ['andy', 'tim']}
choices = map(lambda (k, v): (k, [('%s_%s' % (k, x), x) for x in v]), grouped_users.items())
print choices # [('admin', [('admin_root', 'root')]), ('group1', [('group1_andy', 'andy'), ('group1_tim', 'tim')])]

What is Visual Studio Code?

“Visual Studio Code is a lightweight source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as .NET and Unity).” ~ Visual Studio Code

What is Homebrew?

Homebrew is a free and open-source software package management system for the Apple’s macOS operating system. It is known as „the missing package manager for macOS“; like „apt“ or „apt-get“ on Linux OS.

Quick Commands

@dkdndes
dkdndes / fontawesome_icons_free.json
Created February 25, 2020 20:12
Font Awesome Icons in Python JSON
# -*- coding: utf-8 -*-
# This file was generated automatically by fontawesome-python
#
# $ python fontawesome/generate.py > fontawsome.json
#
# It contains the icon set from: https://github.com/FortAwesome/Font-Awesome
# The content is licensed under the SIL OFL 1.1: http://scripts.sil.org/OFL
VERSION = 'master'
<!DOCTYPE html>
<meta charset="utf-8" />
<title>WebSocket Test</title>
<script language="javascript" type="text/javascript">
var wsUri = "ws://echo.websocket.org/";
var output;