Skip to content

Instantly share code, notes, and snippets.

View MechanisM's full-sized avatar
💩

Eugene MechanisM MechanisM

💩
  • MechanisM
  • Vancouver, BC, Canada
View GitHub Profile
@MechanisM
MechanisM / ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
Created November 6, 2019 00:08 — forked from Brainiarc7/ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
ffmpeg livestreaming to youtube via Nvidia's NVENC and Intel's VAAPI on supported hardware

Streaming your Linux desktop to Youtube and Twitch via Nvidia's NVENC and VAAPI:

Considerations to take when live streaming:

The following best practice observations apply when using a hardware-based encoder for live streaming to any platform:

  1. Set the buffer size (-bufsize:v) equal to the target bitrate (-b:v). You want to ensure that you're encoding in CBR mode.

  2. Set up the encoders as shown:

@FZambia
FZambia / index.html
Last active June 5, 2019 08:48
Centrifuge library Habr example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- Обратите внимание, что клиент тут импортируется из ветки c2 репозитория centrifuge-js -->
<script type="text/javascript" src="https://rawgit.com/centrifugal/centrifuge-js/c2/dist/centrifuge.min.js"></script>
</head>
<body>
<input type="text" id="input" />
<script type="text/javascript">
@FZambia
FZambia / nginx.conf
Created March 22, 2018 20:04
Nginx to proxy Websocket and GRPC traffix on the same port
events {
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent"';
map $http_upgrade $connection_upgrade {
default upgrade;
@tague
tague / gist:a23e7f6b2c8f86985f316026c3583741
Created February 8, 2018 18:25
generate_station_kml.py
#!/usr/bin/env python3
import redis
import xml.dom.minidom as minidom
def generate_placemark(doc, document, station):
"Generates a single place mark from a station"
placemark = doc.createElement('Placemark')
document.appendChild(placemark)
@adamcharnock
adamcharnock / howto.md
Last active June 18, 2020 01:48
Kubernetes install on Ubuntu 17.10 via kubeadm

Kubernetes install on Ubuntu 17.10 via kubeadm

Initial setup

apt-get update
apt-get upgrade
apt-get install curl

# Check VXLAN exists
@jochemstoel
jochemstoel / meta-tags.md
Created September 4, 2017 07:36 — forked from whitingx/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@antoniocsoares
antoniocsoares / findDuplicateItemsArrays.js
Last active July 28, 2022 02:28
Find duplicate items in arrays using ES6
// ES6
// Count duplicate items
const names = ['Mike', 'Matt', 'Nancy', 'Adam', 'Jenny', 'Nancy', 'Carl']
const count = names =>
names.reduce((a, b) =>
Object.assign(a, {[b]: (a[b] || 0) + 1}), {})
const duplicates = dict =>
@Brainiarc7
Brainiarc7 / ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
Last active April 21, 2024 04:22
ffmpeg livestreaming to youtube via Nvidia's NVENC and Intel's VAAPI on supported hardware

Streaming your Linux desktop to Youtube and Twitch via Nvidia's NVENC and VAAPI:

Considerations to take when live streaming:

The following best practice observations apply when using a hardware-based encoder for live streaming to any platform:

  1. Set the buffer size (-bufsize:v) equal to the target bitrate (-b:v). You want to ensure that you're encoding in CBR mode.

  2. Set up the encoders as shown:

@bithavoc
bithavoc / postgres-notify-trigger.sql
Last active February 2, 2019 09:31
I used this trigger to notify table changes via NOTIFY (migrating off RethinkDB)
CREATE OR REPLACE FUNCTION notify_trigger() RETURNS trigger AS $$
DECLARE
channel_name varchar DEFAULT (TG_TABLE_NAME || '_changes');
BEGIN
IF TG_OP = 'INSERT' THEN
PERFORM pg_notify(channel_name, '{"id": "' || NEW.id || '"}');
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
PERFORM pg_notify(channel_name, '{"id": "' || OLD.id || '"}');
from hashlib import sha1
class YandexMoheyHash:
"""
Integrity check for Yandex.Money HTTP-notifications
Usage example:
yahash = YandexMoheyHash(request.POST, settings.YANDEX_MONEY_SECRET)
if yahash.check(request.POST['sha1_hash']):