Skip to content

Instantly share code, notes, and snippets.

View eldog's full-sized avatar

Lloyd Henning eldog

View GitHub Profile
@conorbuck
conorbuck / angle-between-points.js
Created May 5, 2012 22:51
JavaScript: Find the angle between two points
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
@PhirePhly
PhirePhly / memdjpeg.c
Created July 10, 2012 02:33
A bare-bones example of how to use jpeglib to decompress a jpg in memory.
// memdjpeg - A super simple example of how to decode a jpeg in memory
// Kenneth Finnegan, 2012
// blog.thelifeofkenneth.com
//
// After installing jpeglib, compile with:
// cc memdjpeg.c -ljpeg -o memdjpeg
//
// Run with:
// ./memdjpeg filename.jpg
//
@cobusc
cobusc / postgresql_date_function_index_howto.md
Last active July 26, 2024 09:16
Short explanation of the issues faced when trying to create a PostgreSQL index using the date() function and how to resolve it.
@michaeltyson
michaeltyson / test.py
Created March 2, 2014 06:31
Python + Gst + Cairo Overlay
#!/usr/bin/env python
import gi
import sys
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
import cairo
class Renderer():
OVERLAY_FRAME_WIDTH = 320
@coderanger
coderanger / README.md
Last active August 18, 2023 18:33
How to patch Ubuntu for Heartbleed

How to patch Ubuntu for Heartbleed

  1. sudo apt-get update
  2. sudo apt-get install -y libssl1.0.0 openssl
  3. openssl version -a and confirm the "built on" date is >= 2014-04-07
  4. sudo lsof -n | grep ssl | grep DEL and restart all listed services.

Repeat #4 until no results are returned.

@max-mapper
max-mapper / readme.md
Last active May 21, 2022 11:02
ffmpeg youtube live event rtmp stream from raspberry pi with raspi camera (raspivid)
  1. compile ffmpeg for arm https://github.com/fiorix/ffmpeg-arm
  2. create youtube 'live event'. get rtmp url + session id
  3. run this:
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/<SESSION>

you can tweak -b and -fps to your liking. the settings above work well for 1080p. by not specifying width or height we get the full 1920x1080 resolution from the raspi camera

@bitwes
bitwes / sample_command_line.gd
Created November 28, 2015 19:09
Robust command line argument parsing in Godot
# Example of a script that can be run from the command line and parses out options. This is adapted
# from the Gut command line interface. The first 2 classes are not to be used directly, they are used
# by the Options class and can be ignored. Start reading after the Options class to get a feel for
# how it is used, then work backwards.
#
# This could be easily extracted out into a class itself, but in the interest of how it is being used
# I wanted it all in one file. It is yours to do with what you please, but if you make something out
# of it, I'd love to hear about it. I'm bitwes on godot forums, github, and bitbucket.
extends SceneTree
@Enhex
Enhex / Urho3D render order behind.cpp
Last active August 20, 2017 19:48
Urho3D render order in front
Node* planeNode = scene_->CreateChild("Plane");
planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
auto mat = cache->GetResource<Material>("Materials/StoneTiled.xml")->Clone();
mat->SetRenderOrder(100); // Lower render order to render first
auto tecs = mat->GetTechniques();
for (size_t i = 0; i < tecs.Size(); ++i)
{
class LowPassFilter {
constructor(alpha) {
this.setAlpha(alpha);
this.y = null;
this.s = null;
}
setAlpha(alpha) {
if (alpha <= 0 || alpha > 1.0) {
throw new Error();
@mphuie
mphuie / index.html
Last active November 10, 2024 17:30
pyqt webview javascript -> python example
<html>
<head>
<script src="qrc:///qtwebchannel/qwebchannel.js"></script>
<style>
::selection {
background:transparent;
}
</style>
</head>