Skip to content

Instantly share code, notes, and snippets.

View kyleparisi's full-sized avatar

Kyle Parisi kyleparisi

  • Newtown, PA
View GitHub Profile
niuware /
Created October 18, 2019 03:41
How to stream a CSV file from a large QuerySet using Django's StreamingHttpResponse

Stream a CSV file from a QuerySet using StreamingHttpResponse

This is a sample on how to stream the results of a large QuerySet into a CSV file using Django StreamingHttpResponse class.

  1. Add the CSVStream class in your project, for example a file:
import csv
from django.http import StreamingHttpResponse
DavidKuennen / minimal-analytics-snippet.js
Last active June 9, 2024 19:08
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
mrbar42 /
Last active June 18, 2024 16:43
Secured HLS setup with Nginx as media server

Secured HLS setup with Nginx as media server

This example is part of this article.

This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:

  • Domain filtering
  • Referrer filtering
  • Embed buster
jguix / recursive-promise.ts
Last active December 10, 2022 16:22
How to create a recursive promise chain. Source,console
// A recursive function returning Promise<number>
function recurseToZero(n) {
console.log('B. Entering recursive function for [' + n + '].');
// Once we hit zero, bail out of the recursion. The key to recursion is that
// it stops at some point, and the callstack can be "rolled" back up.
if (n === 0) {
// We could just return 0 but we do return Promise.resolve to have a consistent return type
return Promise.resolve(0);
// Start a NEW PROMISE CHAIN that will become the continuation of the parent
a7madgamal /
Last active July 14, 2023 04:00
Dark mode for Slack on MacOS
tj / Makefile
Last active March 11, 2017 13:31
imgix favicons
# Imgix image replacement.
@echo "==> pointing images to $(IMAGE_CDN)"
@find build -type f -name "*.html" | xargs sed -i '' 's|src="/images|src="$(IMAGE_CDN)/images|g'
@find build -type f -name "*.html" | xargs sed -i '' 's|href="/images|href="$(IMAGE_CDN)/images|g'
.PHONY: images
blackode / password_logger.ex
Created February 14, 2017 10:18
GenServer for simple logging mechanism
defmodule PasswordLogger do
use GenServer
# -------------#
# Client - API #
# -------------#
@moduledoc """
Documentation for Password_logger.
loggs the password
so0k /
Last active April 25, 2024 12:40
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
exec > /tmp/${PROJECT_NAME}_archive.log 2>&1
if [ "true" == ${ALREADYINVOKED:-false} ]
echo "RECURSION: Detected, stopping"
export ALREADYINVOKED="true"
tj / Connector.js
Last active November 26, 2019 15:43
import React from 'react'
const bgStyles = {
strokeWidth: 3,
strokeLinejoin: 'round',
strokeLinecap: 'round',
fill: 'none',
stroke: '#c3fdff'