Skip to content

Instantly share code, notes, and snippets.

View bhcopeland's full-sized avatar

Benjamin Copeland bhcopeland

View GitHub Profile
@bhcopeland
bhcopeland / whatpulse_running.sh
Created December 12, 2013 21:15
is whatpulse running - crontab script to start whatpulse when it dies
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
export DISPLAY=:0.0
export DISPLAY=:0
RESULT=`ps -A | sed -n /whatpulse/p`
if [ "${RESULT:-null}" = null ]; then
echo "whatpulse not running "
#xmessage "whatpulse not running"
@bhcopeland
bhcopeland / etherpad-lite-multiplesites-init.d
Last active January 3, 2016 23:59
Etherpad-lite multiple sites/instances init script: etherpad-lite supports multiple settings.json files with the "-s" parameter on run.sh. I modified the init.d script to support multiple settings.json start up.
#!/bin/bash
### BEGIN INIT INFO
# Provides: etherpad-lite
# 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 etherpad lite
# Description: starts etherpad lite using start-stop-daemon
@bhcopeland
bhcopeland / 10-monitor.conf
Created January 21, 2014 13:21
Macbook pro Retina 11,1 xorg.conf run at 1920x1200 resolution. /etc/X11/xorg.conf.d/10-monitor.conf
Section "Monitor"
Identifier "Monitor0"
Modeline "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
EndSection
Section "Screen"
Identifier "Screen0"
Device "eDP1"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
@bhcopeland
bhcopeland / cr2tojpg
Created January 26, 2014 16:26
Simple script that uses ufraw-batch to convert CR2 (raw) images into JPG.
#!/bin/bash
######################
##Simple script that uses ufraw-batch to convert CR2 (raw) images into JPG.
##Place the script inside /usr/bin/cr2tojpg
##Usage: cr2tojpg /your/image/location
##Ben Copeland 2014 https://github.com/bhcopeland 26/01/14
#######################
cd $1
if [[ -z "$1" ]]; then
@bhcopeland
bhcopeland / nvidia_zabbix_template.conf
Last active October 27, 2017 15:32
nvidia-smi, temperature, fan speed and memory details. Zabbix UserParameter and Template
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2014-07-13T23:42:46Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
@bhcopeland
bhcopeland / delete_users_or_domains_from_private_mailmanlists.sh
Last active August 29, 2015 14:11
Delete @example.com or email addresses from PRIVATE mailman lists.
#!/bin/bash
# This script DELETES for given user or domain from *PRIVATE* lists.
# https://github.com/bhcopeland
# Syntax ./script_name.sh first.lastname@address.com
# ./script_name.sh firstname.lastname
# ./script_name.sh @domain.com
if [[ $@ ]]; then
for mailinglist in $(comm -23 <(list_lists -b) <(list_lists -b -a))
do
@bhcopeland
bhcopeland / require_updated_git_branch.py
Created December 11, 2014 09:23
ansible callback_plugin to check that the locally git directory is up to date/in sync.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import subprocess
import sys
from ansible.callbacks import display, banner
@bhcopeland
bhcopeland / conky-i3bar
Last active August 29, 2015 14:13
i3 setup for desktop and laptop. Dependences: dunst, conky. feh, conkyclementine, Faenza-Dark-Icon, Faenza-Dark, mediterraneannight-theme
### Conky configuration file
## No output to X <yes/no>
out_to_x no
## Create own window to draw <yes/no>
own_window no
## Print everything to console?
@bhcopeland
bhcopeland / Ansible Ensure fstab uses defined options
Last active August 29, 2015 14:17
Ensures a option is in fstab using ansible. In this case nobootwait and noatime
- name: Ensure fstab uses nobootwait and noatime
mount:
name: "{{ item.mount }}"
src: "{{ item.device }}"
fstype: "{{ item.fstype }}"
opts: "{{ item.options.split(',') | union(['nobootwait','noatime']) | join(',') }}"
state: present
with_items: ansible_mounts
when: item.options.find("nobootwait") == -1 or item.options.find("noatime") == -1
tags:
@bhcopeland
bhcopeland / ssd_benchmark.sh
Last active August 29, 2015 14:17
ssd_benchmark.sh
echo "write"
dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc
echo "read"
sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
dd if=tempfile of=/dev/null bs=1M count=1024
echo "Re-Read"
dd if=tempfile of=/dev/null bs=1M count=1024