Skip to content

Instantly share code, notes, and snippets.

View bramus's full-sized avatar

Bramus bramus

View GitHub Profile
@bramus
bramus / userChrome.css
Created December 2, 2010 00:12
Mozilla Firefox 4.0 (beta) userChrome.css adjustments to place the close buttons on the left hand side of the tab.
/*
* Do not remove the @namespace line -- it's required for correct functioning
*/
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
/* move favicon, throbber and text to the right so that the close button appears on the left */
.tabbrowser-tab .tab-icon-image {
-moz-box-ordinal-group: 2 !important;
}
@bramus
bramus / gist:1876700
Created February 21, 2012 14:01
Zonder homepage caching
bramus@shared-015:~$ ab -c 5 -n 100 http://www.bram.us/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.bram.us (be patient).....done
Server Software: Apache/1.3.42
Server Hostname: www.bram.us
@bramus
bramus / gist:1876703
Created February 21, 2012 14:01
Met homepage caching
bramus@shared-015:~$ ab -c 5 -n 100 http://www.bram.us/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.bram.us (be patient).....done
Server Software: Apache/1.3.42
Server Hostname: www.bram.us
@bramus
bramus / .htaccess
Last active November 10, 2023 20:20
URL Rewriting for Apache (requires mod_rewrite) and IIS (requires IIS url rewrite module)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
@bramus
bramus / script.js
Created October 18, 2013 09:26
getUserMedia with video element
// @url http://www.html5rocks.com/en/tutorials/getusermedia/intro/
window.URL = window.URL || window.webkitURL;
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
if (navigator.getUserMedia) {
navigator.getUserMedia({audio: true, video: true}, function(stream) {
document.querySelector('video').src = window.URL.createObjectURL(stream);
}, function(e) {
console.log(e);
@bramus
bramus / kungfoo.html
Created October 18, 2013 21:09
Kung foo? (found this in my archives somewhere, don't know if it would still work)
<html>
<head>
<title>Kung foo?</title>
</head>
<body>
<script language="VBScript">
<!--
Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
@bramus
bramus / myservice
Created November 11, 2013 11:23
Running a PHP script as a service/daemon using `start-stop-daemon`
#! /bin/sh
# Installation
# - Move this to /etc/init.d/myservice
# - chmod +x this
#
# Starting and stopping
# - Start: `service myservice start` or `/etc/init.d/myservice start`
# - Stop: `service myservice stop` or `/etc/init.d/myservice stop`
@bramus
bramus / redirect.php
Created December 4, 2013 11:12
Enforce HTTPS
<?php
if ((((int) $_SERVER['SERVER_PORT']) !== 443) && (!isset($_SERVER['HTTPS']) || ($_SERVER['HTTPS'] == 'off'))) {
header("HTTP/1.1 301 Moved Permanently");
header('location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
exit();
}
?>
@bramus
bramus / vimeothumb.php
Created January 22, 2014 08:45
Vimeo Thumbnail Script - Gets the poster frame for a Vimeo video id.
<?php
/**
* Vimeo Thumbnail Script - Gets the poster frame for a Vimeo video id.
* @author Bramus Van Damme <bramus@bram.us>
*
* Example Request: vimeothumb.php?id=83936766
*/
// Perform a GET request to a given URL.

Keybase proof

I hereby claim:

  • I am bramus on github.
  • I am bramus (https://keybase.io/bramus) on keybase.
  • I have a public key whose fingerprint is 4DE2 5A54 D217 D318 C448 AD5E BCA6 D920 A543 86D7

To claim this, I am signing this object: