Skip to content

Instantly share code, notes, and snippets.

View matagus's full-sized avatar
🐿️
I miss the old Github activity stream

Matías Agustín Méndez matagus

🐿️
I miss the old Github activity stream
View GitHub Profile
@keijiro
keijiro / 00_blot5.md
Last active October 15, 2021 12:13
KodeLife fragment shader sketch

gif

@tricoder42
tricoder42 / 00_GraphQL_Subscriptions.md
Last active February 22, 2023 12:40
GraphQL Subscriptions with django-channels

GraphQL Subscription with django-channels

Django channels are official way for implementing async messaging in Django.

The primary caveat when working with GraphQL subscription is that we can't serialize message before broadcasting it to Group of subscribers. Each subscriber might use different GraphQL query so we don't know how to serialize instance in advance.

See related issue

@4383
4383 / client.py
Last active September 29, 2021 15:03
asyncio - shared socket between coroutines
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
async def init_socket (loop):
reader, writer = await asyncio.open_connection('127.0.0.1', 3000, loop=loop)
return reader, writer
@mendhak
mendhak / update-another-users-pullrequest.md
Last active July 26, 2023 07:35
Update a pull request by pushing to another user's forked repository

Add the other user as a remote

#Using https
git remote add otheruser https://github.com/otheruser/yourrepo.git
# Or - Using SSH
git remote add otheruser git@github.com:otheruser/yourrepo.git

Fetch

git fetch otheruser

@matagus
matagus / app.py
Created May 1, 2017 17:20
Monitoring a Python Falcon Framework application using NewRelic
import newrelic.agent
newrelic.agent.initialize('newrelic.ini')
api = application = newrelic.agent.WSGIApplicationWrapper(falcon.API())
@jherax
jherax / is-private-mode.js
Last active March 19, 2024 18:29
Detect if the browser is running in Private mode - Promise based (last update: Feb 2020)
/**
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise<boolean>}
*
* Live demo:
* @see https://output.jsbin.com/tazuwif
*
* This snippet uses Promises. If you want to run it in old browsers, polyfill it:
* @see https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js
*
@vitorfs
vitorfs / github_webhooks.py
Last active June 25, 2022 14:51
Handling GitHub Webhooks Using Django
import hmac
from hashlib import sha1
from django.conf import settings
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseServerError
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from django.utils.encoding import force_bytes
import requests
@juanpabloaj
juanpabloaj / README.md
Last active June 18, 2018 13:02
Total of pip packages downloaded, separated by Python versions

Total of pip packages downloaded separated by Python versions

From June 26, 2016 (python 3.5.2 release) to Aug. 31, 2016.

Python versions from 2.6 to 3.5

downloads_by_versions

Without 2.7

@cocoalabs
cocoalabs / gist:2fb7dc2199b0d4bf160364b8e557eb66
Created August 15, 2016 21:50
Color Terminal for bash/zsh etc..
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"