Skip to content

Instantly share code, notes, and snippets.

@bfg
bfg / apache-2.2-mod_remoteip.c
Created June 23, 2011 09:32
Working backport (doesn't crash when using Allow/Deny ACLs) of Apache 2.3 module mod_remoteip to Apache 2.2.x
/* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@bfg
bfg / ngx_http_smooth_streaming-1.4.24-ism_rewrite_engine.patch
Created December 21, 2011 12:07
CodeShop ngx_http_smooth_streaming module patch, whichs adds configuration flag ism_rewrite_engine {on=default|off}; You can disable built-in rewrite engine with this patch. Applies to version 1.4.24; sample configuration: http://pastebin.com/HY9Wy6TD
diff -ur orig.nginx_mod_smooth_streaming-1.4.24/src/ngx_http_streaming_module.c nginx_mod_smooth_streaming-1.4.24/src/ngx_http_streaming_module.c
--- orig.nginx_mod_smooth_streaming-1.4.24/src/ngx_http_streaming_module.c 2011-04-24 16:55:51.000000000 +0200
+++ nginx_mod_smooth_streaming-1.4.24/src/ngx_http_streaming_module.c 2011-12-21 01:21:03.058062179 +0100
@@ -70,6 +70,13 @@
*/
#endif
+/**
+ * Configuration structure for the smooth streaming module.
+ */
#
# tmux configuration
#
# remap CTRL+B => CTRL+A (screen like shit)
set -g prefix C-a
unbind C-b
# bind PREFIX + r => reload tmux config && print notice
bind r source-file ~/.tmux.conf \; display "tmux configuration was reloaded!"
@bfg
bfg / keybase.md
Created August 17, 2015 20:15
keybase.md

Keybase proof

I hereby claim:

  • I am bfg on github.
  • I am gracnar (https://keybase.io/gracnar) on keybase.
  • I have a public key whose fingerprint is 9899 6477 8792 203C EDCB 3683 0EAD 2EB5 F590 D619

To claim this, I am signing this object:

@bfg
bfg / osx_gnu_utils_usage
Created September 12, 2016 06:36
Shell (.profile/.bash_profile) script fragment for osx that installs gnu utils using brew
#
# shell dot-profile fragment
#
is_osx() {
test "$(uname -s)" = "Darwin"
}
check_is_osx() {
if ! is_osx; then
@bfg
bfg / git-version.sh
Last active November 16, 2023 18:35
git-version.sh
#!/bin/sh
#
# NOTE: variables and functions are prefixed with `_` so that file can be safely sourced into a current
# shell in a attempt to prevent name clashes
_GIT_ENV=""
_GIT_JSON=""
_GIT_PROPS=""
_PROJECT_VERSION=""
@bfg
bfg / gitlab-fix-project-permissions.sh
Created November 16, 2023 18:29
gitlab-fix-project-permissions.sh :: fixes gitlab-saas runner issue where git repositories are being cloned with umask 0000
#!/bin/sh
set -e
die() {
echo "FATAL: $@" 1>&2
exit 1
}
test -z "$1" -o "$1" = "-h" -o "$1" = "--help" && {
@bfg
bfg / Optional.php
Created April 25, 2024 17:34
PHP implementation of Optional monad
<?php
use ArrayIterator;
use Iterator;
use IteratorAggregate;
use RuntimeException;
use Throwable;
/**
* Optional value container that can hold a single result and can be used in foreach loop