Skip to content

Instantly share code, notes, and snippets.

View bhcopeland's full-sized avatar

Benjamin Copeland bhcopeland

View GitHub Profile
@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 / 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
@bhcopeland
bhcopeland / conky-i3bar
Created May 29, 2015 11:13
conky-i3bar
### 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 / nginx.conf - Owncloud, ampache, php-fpm.
Last active August 29, 2015 14:25
nginx.conf - Owncloud, ampache, php-fpm.
user www-data;
worker_processes 4;
events {
worker_connections 4069;
}
http {
include mime.types;
default_type application/octet-stream;
@bhcopeland
bhcopeland / Dockerfile
Created July 23, 2015 13:45
Docker file to deploy ansible playbook
# Builds ubuntu latest image from docker hub
# Install and setups ansible
# Run from ansible dir: "docker build -t ansible_deploy ."
# You will need to update the playbook you deploy in this file.
FROM ubuntu
MAINTAINER Ben Copeland <ben.copeland@linaro.org>
RUN apt-get install -y software-properties-common
@bhcopeland
bhcopeland / .i3-conkyrc
Created August 3, 2015 09:31
.i3-conkyrc
out_to_x no
own_window no
out_to_console yes
background no
max_text_width 0
update_interval 2.0
total_run_times 0
short_units yes
if_up_strictness address
use_spacer left
import socks
import socket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)
socket.socket = socks.socksocket
import requests
r = requests.get('http://bit.ly/1L29AfA')
open('yify.xml', 'wb').write(r.content)
@bhcopeland
bhcopeland / zabbix_screen_create.sh
Last active October 12, 2015 15:01
Create zabbix screens locally with ansible
#!/usr/bin/ansible-playbook -c local
---
# Requires zabbix-api to be installed locally.
# Uses -c local, to run the playbook on local machine.
# Run inside the playbook folder, to pick up correct vars
- name: Ensure zabbix screens exists
hosts: zabbix-server
gather_facts: false