Skip to content

Instantly share code, notes, and snippets.

@markcaudill
markcaudill / gist:c161b4d30f7f7ffdabbe
Created June 15, 2015 11:44
BCM4352 on Fedora 22
# Install RPM Fusion
sudo dnf install http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-22.noarch.rpm
sudo dnf install http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-22.noarch.rpm
# The rest
sudo dnf install kernel-devel broadcom-wl akmod-wl akmods
sudo akmods
sudo reboot
@markcaudill
markcaudill / max_clients.sh
Created June 22, 2012 19:09
Determine the best Apache MaxClients parameter.
#!/bin/bash
# Copyright (c) 2012 Mark Caudill <mark@markcaudill.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# -*- coding: utf-8 -*-
from datetime import datetime
import sublime_plugin
class TimestampCommand(sublime_plugin.EventListener):
"""Expand `isoD`, `now`, `datetime`, `utcnow`, `utcdatetime`,
`date` and `time`
"""
#!/bin/bash
tmpdir=$(mktemp -d)
s3bucket="s3://MY_BUCKET"
backup="$(date '+%Y-%m-%d-%H%M').tbz"
orig_pwd=$(pwd)
cd $HOME/..
logger -s -i "Backing up $HOME to $s3bucket/$(hostname -s)/$backup"
# Compress
#!/usr/bin/python
import xmlrpclib
SAT_URL = "https://<SATELLITE_IP>/rpc/api"
SAT_USER = "<USERNAME>"
SAT_PASS = "<PASSWORD>"
client = xmlrpclib.Server(SAT_URL, verbose=0)
key = client.auth.login(SAT_USER, SAT_PASS)
@markcaudill
markcaudill / form.py
Created June 1, 2013 13:28
A simple CGI to receive arbitrary form submission data and send it via email (with optional GPG encryption) to you (or some other admin).
#!/usr/bin/python
# Copyright (C) 2013 Mark Caudill
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>tmplog</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
#!/bin/sh
cd /tmp/
sudo apt-get install build-essential
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar -xzf Python-2.7.2.tgz
cd Python-2.7.2
sudo apt-get install libsqlite3-dev zlib1g-dev libncurses5-dev
sudo apt-get install libgdbm-dev libbz2-dev libreadline5-dev
sudo apt-get install libssl-dev libdb-dev
./configure --enable-shared
--- functions.php.orig 2012-07-04 00:20:58.000000000 +0000
+++ functions.php 2012-07-04 00:34:48.000000000 +0000
@@ -1641,14 +1641,14 @@
*/
function wp_ext2type( $ext ) {
$ext2type = apply_filters( 'ext2type', array(
- 'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
- 'video' => array( 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ),
- 'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'rtf', 'wp', 'wpd' ),
+ 'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
# Copyright (C) 2012 Mark Caudill
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#