Skip to content

Instantly share code, notes, and snippets.

View poppingtonic's full-sized avatar
💭
I may be slow to respond.

Brian Muhia poppingtonic

💭
I may be slow to respond.
View GitHub Profile
@poppingtonic
poppingtonic / ranking.py
Created August 4, 2017 12:10 — forked from fabianp/ranking.py
Pairwise ranking using scikit-learn LinearSVC
"""
Implementation of pairwise ranking using scikit-learn LinearSVC
Reference:
"Large Margin Rank Boundaries for Ordinal Regression", R. Herbrich,
T. Graepel, K. Obermayer 1999
"Learning to rank from medical imaging data." Pedregosa, Fabian, et al.,
Machine Learning in Medical Imaging 2012.
@poppingtonic
poppingtonic / README
Created March 22, 2017 07:28 — forked from mikaelz/README
Fill MPC/MPD playlist with SoundCloud stream URLs
Options:
soundcloud.py --genre
soundcloud.py search
soundcloud.py user
soundcloud.py tracks
soundcloud.py url
soundcloud.py playlist
Usage:
-- defines a factorial function
function fact (n)
if n <= 0 then
return 1
else
return n * fact(n-1)
end
end
print(fact(5))
@poppingtonic
poppingtonic / wikidata2pgsql.py
Created March 2, 2017 18:55 — forked from mocobeta/wikidata2pgsql.py
Python script importing Wikipedia xml dump data to PostgreSQL
# -*- coding: utf-8 -*-
import psycopg2
import xml.sax
from xml.sax.handler import ContentHandler
from dicttoxml import dicttoxml
INSERT_STMT = "INSERT INTO pages (id, page) VALUES('%s', '%s')"
COMMIT_WINDOW = 10000
@poppingtonic
poppingtonic / pg-pong.py
Created February 6, 2017 20:05 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@poppingtonic
poppingtonic / ffmpeg-desktop-livestreaming-nvenc-and netcat.md
Created January 13, 2017 13:41 — forked from Brainiarc7/ffmpeg-desktop-livestreaming-nvenc-and netcat.md
This gist will show you how to livestream your Linux desktop to a client via FFMpeg using a GPU-accelerated video encoder (NVENC and VAAPI-based)

Low-Latency Live Streaming for your Desktop using ffmpeg and netcat

Preamble:

In this post I will explore how to stream a video and audio capture from one computer to another using ffmpeg and netcat, with a latency below 100ms, which is good enough for presentations and general purpose remote display tasks on a local network.

The problem:

@poppingtonic
poppingtonic / VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
Created January 13, 2017 13:40 — forked from Brainiarc7/VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
This gist contains instructions on setting up FFmpeg and Libav to use VAAPI-based hardware accelerated encoding (on supported platforms) for H.264 (and H.265 on supported hardware) video formats.

Using VAAPI's hardware accelerated video encoding on Linux with Intel's hardware on FFmpeg and libav

Hello, brethren :-)

As it turns out, the current version of FFmpeg (version 3.1 released earlier today) and libav (master branch) supports full H.264 and HEVC encode in VAAPI on supported hardware that works reliably well to be termed "production-ready".

Types

A type is a collection of possible values. An integer can have values 0, 1, 2, 3, etc.; a boolean can have values true and false. We can imagine any type we like: for example, a HighFive type that allows the values "hi" or 5, but nothing else. It's not a string and it's not an integer; it's its own, separate type.

Statically typed languages constrain variables' types: the programming language might know, for example, that x is an Integer. In that case, the programmer isn't allowed to say x = true; that would be an invalid program. The compiler will refuse to compile it, so we can't even run it.

Simple Security Guidelines

  • Use an iDevice

    • Use an iPod or an iPad without a SIM card
    • Use an iPhone
    • Do not jailbreak
    • Always upgrade to new iOS versions
  • Use Signal (iOS + Android)

@poppingtonic
poppingtonic / english_to_tengwar.py
Created June 6, 2016 17:12 — forked from csvoss/english_to_tengwar.py
English to Tengwar transliterator
# This file converts English text to Tengwar, using my own personal
# preferences for transliterating Tengwar.
#
# Currently, the output that is created is intended for use with the Tengwar
# Annatar font and related font families.
#
# Example usage:
# >>> print convert("This was a triumph. I'm making a note here: huge success!")
#
# -- then paste the resulting text into a document rendered in Tengwar Annatar.