Skip to content

Instantly share code, notes, and snippets.

View mplscorwin's full-sized avatar
💬
preping for EmacsConf.org

Corwin mplscorwin

💬
preping for EmacsConf.org
View GitHub Profile
@mplscorwin
mplscorwin / erc-countusers-mode
Created January 20, 2020 23:55
Can't ever remember where I stole this code. Sketchy.
;;; erc-countusers-mode.el --- display a count of channel users in the mode-string
;;; Commentary:
;; TODO: return empty string if parted/disconnected
;; TODO: add to emacswiki files
;;; Code:
(define-minor-mode ncm-mode "https://www.emacswiki.org/emacs/ErcModeline
Add this to your .emacs to see the number of opped/voiced/normal members of the
current channel in the modeline:" nil
(:eval
@mplscorwin
mplscorwin / defvar-maybe.el
Created December 20, 2019 04:40
A small utility to make developing well documented vars inline a little more trival.
;;; defvar-maybe.el --- maybe declare variables
;;; AUTHOR: Corwin Brust <corwin@bru.st>
;;; LICENSE: GPL2 or newer GNU Public License
;;; VERSION: 0.2
;;; Commentary:
;;
;; A drop-in replacement for `defvar' that substities 'setq' during "DEVEL".
;; Place the following lines into a package you are hacking on:
;; (require 'defvar-maybe)
@mplscorwin
mplscorwin / gist:8445328
Created January 15, 2014 21:44
fix ownership of cassandra's files when someone goes and runs it other than from "service start cassandra" (CentOS 6)
#!/bin/bash
################################################################################
#
# shell script to fix ownership of all files under each entry in SEARCH_PATH
#
# Change SEARCH_PATH as needed.
# NOTE: script has no output if it does no work.
#
################################################################################
@mplscorwin
mplscorwin / statsd_init.sh
Last active January 3, 2016 08:59 — forked from garlandkr/statsd_init.sh
this version (which I use on CentOS as /etc/init.d/statsd) mimics more closely the "normal" sysV service control script behavior.
#!/bin/sh
### BEGIN INIT INFO
# Provides: statsd
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: control statsd
# Description: start/stop/restart statsd using nodejs forever
@mplscorwin
mplscorwin / diff~.sh
Created November 14, 2013 23:04
Diff a file with its (emacs style) backup
#!/bin/bash
F=$1
shift
diff $* $F $F~
@mplscorwin
mplscorwin / fix_owner.sh
Created November 11, 2013 22:05
fix the owner/group of all files under a set of directories via find and chown
#!/bin/bash
################################################################################
#
# shell script to fix ownership of all files under each entry in SEARCH_PATH
#
################################################################################
# space seperated list of paths
SEARCH_PATHS='/tmp/foo /tmp/bar'
@mplscorwin
mplscorwin / centos_build_cql+metrics.sh
Last active December 27, 2015 17:29
CentOS init for Cassandra + Graphite + StatsD (forever via cron)
################################################################################
#
# CentOS - Graphite/statsD/Cassandra configuration script
#
################################################################################
# This should be performed as root since it's going to be installing a bunch of stuff
##########
# Environment specific - only these are expected to change from dev->prod
#!/bin/sh
### BEGIN INIT INFO
# Provides: statsd
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the statsd node server
# Description: starts statsd using nodejs forever
# First do a fresh install of CentOS 5.7 i386, server configuration (no GUI)
# This should be performed as root since it's going to be installing a bunch of stuff
# --- Update things to make sure we have the latest patches ---
# Add EPEL so we can get reasonably recent packages
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# --- Install all the packages --- #
yum -y install python-whisper python-carbon graphite-web python-memcached python-ldap httpd memcached