Skip to content

Instantly share code, notes, and snippets.

View robinnorth's full-sized avatar
:octocat:

Robin North robinnorth

:octocat:
View GitHub Profile
#!/bin/bash -x
CALLERS_UID="$1"
REFCOUNT_PATH="$2"
DCALL_PATH="$3"
if [ $UID -ne 0 ]; then
# Test that the script is run as root.
echo "Script must run as root"
exit 1
@alienresident
alienresident / video-fix-videos-for-pseudo-streaming.md
Last active April 20, 2024 05:02
How to: Fix pseudo-streaming videos by moving Moov Atom
How to:

Fix pseudo-streaming videos by moving Moov Atom

Relies on some *nix CLI utilities: mediainfo; and qt-faststart (part of ffmpeg). I used homebrew to install them on OS X.

What is pseudo-streaming?

Pseudo streaming is simply a video that can start playing before it's fully dowmloaded. The videos are not streaming but rather progressively downloaded. What's important is that the file metadata (the Moov Atom) is at the start of the file rather than at the end. Usually this is an option set when encoding the file (called quick start or web start). If the files have not been encoded this way you can either re-encode or use a utility to move the Moov Atom. Re-encoding takes much longer than using a utility to move the Moov Atom so here's how to do it.

Steps

First check with mediainfo to see if video 'is streamable':

@nicoverbruggen
nicoverbruggen / CDVCommandQueue.m
Last active August 29, 2015 13:57
Cordova iOS 7.0/7.1 optimizations. Also fixes for 7.1 arm64 crashes in plugins in CordovaLib < 3.5. Also includes fix for no splash screen on iPhone with 3.5" screen.
// Fix for BAD_ACCESS on arm64 devices
// Per this diff: https://git-wip-us.apache.org/repos/asf?p=cordova-ios.git;a=blobdiff;f=CordovaLib/Classes/CDVCommandQueue.m;h=1eddfe37ee699289701cd4caaf68486607010501;hp=902dfa0227f1358296d2218fa0e6d5cc2a882ea6;hb=82ce4f2;hpb=7da5f2df3417de68a1b540bc00c11a95ce3dc7d6
// Should be fixed in CordovaLib 3.5
SEL normalSelector = NSSelectorFromString(methodName);
if ([obj respondsToSelector:normalSelector]) {
// [obj performSelector:normalSelector withObject:command];
((void (*)(id, SEL, id))objc_msgSend)(obj, normalSelector, command); // replace the old line with this one
} else {
// There's no method to call, so throw an error.
@andrewlkho
andrewlkho / gist:10739376
Last active December 24, 2018 16:57
Clean URLs on jekyll/Apache

This was originally posted on 2011-07-11 to http://andrewho.co.uk/weblog/clean-urls-on-jekyll-apache

I use a static site generator, specifically [jekyll][], to transform some templates into a set of static *.html files. However, I like to keep the URLs looking clean, and not display the .html extension both because I think it looks better and also so that the URLs purely reflect the content and not the underlying files or CMS used to serve that content. In short, whilst the file being served might be $DOCUMENT_ROOT/weblog/title.html, the canonical URL for that resource should be /weblog/title. Here's how I do that in .htaccess.

@passsy
passsy / material text sizes.md
Last active May 25, 2023 04:24
Material font sizes
@niyazpk
niyazpk / pQuery.js
Created October 25, 2014 14:03
Add or update query string parameter
// Add / Update a key-value pair in the URL query parameters
function updateUrlParameter(uri, key, value) {
// remove the hash part before operating on the uri
var i = uri.indexOf('#');
var hash = i === -1 ? '' : uri.substr(i);
uri = i === -1 ? uri : uri.substr(0, i);
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
@jasonclark
jasonclark / social-media-share-markup
Last active January 27, 2017 15:43
Minimum viable social metadata markup - opengraph and twitter; Based on: https://dev.twitter.com/cards/getting-started#opengraph
<meta property="og:title" content="EmbedThis (Oembed)"/>
<meta property="og:description" content="Utility app that checks for an Oembed endpoint & returns HTML embed code."/>
<meta property="og:image" content="http://www.lib.montana.edu/~jason/files/oembed-this/meta/img/share-code-small.png"/>
<meta property="og:url" content="http://www.lib.montana.edu/~jason/files/oembed-this/index.php"/>
<meta property="og:type" content="website"/>
<meta name="twitter:creator" property="og:site_name" content="@jaclark"/>
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="http://www.jasonclark.info"/>
@Naphier
Naphier / UGuiTextToTextMeshPro.cs
Created January 4, 2017 15:23
Unity3D Editor Tool to convert Unity GUI Text objects to Text Mesh Pro Text Objects
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
using TMPro;
using TMPro.EditorUtilities;
public class UGuiTextToTextMeshPro : Editor
{
[MenuItem("GameObject/UI/Convert To Text Mesh Pro", false, 4000)]
static void DoIt()
@ChrisMcKee
ChrisMcKee / PredicatableGuid.cs
Last active April 19, 2024 08:49
Namespaced Deterministic Guid - RFC 4122 dotnetcore
using System;
using System.Security.Cryptography;
using System.Text;
namespace Utility
{
/// <summary>
/// Helper methods for working with <see cref="Guid"/>.
/// </summary>
public static class GuidUtility
@simonbroggi
simonbroggi / BuildAutomation.cs
Last active March 14, 2024 06:01
Build mutliple Unity applications for multiple platforms with one click
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class BuildAutomation {
public struct BuildTargetAndGroup {
public BuildTargetGroup group;
public BuildTarget target;