Skip to content

Instantly share code, notes, and snippets.

View fwenzel's full-sized avatar
😈

Fred Wenzel fwenzel

😈
View GitHub Profile
@fwenzel
fwenzel / cordovasample.sh
Created March 11, 2014 19:19
Script to clone and build Cordova Sample app
#!/bin/sh
## Script to build Cordova Sample app, as described in this blog post:
# https://hacks.mozilla.org/2014/02/building-cordova-apps-for-firefox-os/
# Note, this assumes you have Cordova installed.
# More info: http://cordova.apache.org/
cordova create cordovasample
cd cordovasample
@fwenzel
fwenzel / cordova.js
Created February 19, 2014 17:57
An example cordova.js file, line 1112 might (but won't) violate CSP
// Platform: firefoxos
// 3.3.0
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
@fwenzel
fwenzel / ocr.py
Created January 15, 2014 04:57
A mildly inaccurate OCR function
import itertools; import random
ocr = lambda i: ' '.join(itertools.repeat('POOP', random.randint(0, 100)))
@fwenzel
fwenzel / cloc.py
Last active December 10, 2015 00:18
A simple script to determine what portions of a web app are HTML/CSS/JS. Uses the tool ``cloc``.
#!/usr/bin/env python
"""This requires Python 2.7. Deal with it."""
import shlex
import sys
import xml.etree.ElementTree as ET
from subprocess import check_output
# Language -> [extension, ...] mapping
@fwenzel
fwenzel / install_makemkv.sh
Last active January 21, 2021 14:10
A convenient little script to install MakeMKV on Linux
#!/bin/bash
if [ "$1" == "" ]; then
echo "Usage: $0 1.8.0"
echo "to download and install MakeMKV 1.8.0"
exit 1
fi
# Collect sudo credentials
sudo -v

Hi!

I'm not currently looking for a job as I'm pretty happy at my current job.

However Mozilla is looking for a recruiting manager in Mountain View. Mozilla also has deep ties in the open source communities and it sounds like it might be an interesting fit for you. <OPTIONAL-ADDITIONAL-TEXT>

If you're interested in applying, check out our careers link:

@fwenzel
fwenzel / plex_restart.sh
Created April 26, 2012 03:17
Simple watchdog script to restart plex media server if it becomes unresponsive.
#!/bin/bash
# If plex is not running, don't do anything.
plex_running=`ps ax | grep "\./Plex Media Server" | awk '{ print $1 }' | wc -l`
if [ "$plex_running" -eq 1 ]; then
exit 0
fi
# Test Plex web interface. If it's dead, this'll time out in a few seconds.
curl -I -m 8 "http://localhost:32400/library/sections" > /dev/null 2>&1
@fwenzel
fwenzel / toolbar-button.js
Created March 31, 2012 22:41
A way to add a Firefox toolbar button with the addons SDK
/** Hat tip to <http://stackoverflow.com/questions/5572632/> */
var data = require("self").data;
var {Cc, Ci} = require("chrome");
var mediator = Cc['@mozilla.org/appshell/window-mediator;1'].getService(Ci.nsIWindowMediator);
/**
* Add a toolbar button to the main nav bar.
*
* options you may want to set:
@fwenzel
fwenzel / video.html
Created March 20, 2012 16:45
An example video tag, first webm, then ogv, then mp4.
<video id="movie" width="640" height="360" preload="none" controls poster="http://blog.mozilla.com/webdev/files/2011/07/mozilla_wht.png">
<source src="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.webm" type='video/webm; codecs="vp8, vorbis"' />
<source src="http://videos-cdn.mozilla.netserv/flux/playdoh/playdoh-overview.theora.ogv" type='video/ogg; codecs="theora, vorbis"' />
<source src="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.mp4" />
<p>Download video as <a href="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.mp4">MP4</a>, <a href="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.webm">WebM</a>, or <a href="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.theora.ogv">Ogg</a>.</p>
</video>
@fwenzel
fwenzel / minecraft_64bitify.sh
Created March 18, 2012 21:32
Switch out Minecraft's Java Application Stub on OSX Lion and force 64bit mode.
#!/bin/sh
# Thank you, StackExchange: http://gaming.stackexchange.com/questions/44822/64-bit-java-not-recognized-in-minecraft
gzip /Applications/Minecraft.app/Contents/MacOS/JavaApplicationStub # save a backup
cp /System/Library/Frameworks/JavaVM.framework/Versions/Current/Resources/MacOS/JavaApplicationStub /Applications/Minecraft.app/Contents/MacOS/
/usr/libexec/PlistBuddy -c "Add :Java:JVMArchs:0 string 'x86_64'" /Applications/Minecraft.app/Contents/Info.plist