Skip to content

Instantly share code, notes, and snippets.

@joltcan
joltcan / fnmatch-exclude.txt
Last active March 30, 2018 09:18
Exclude file for fnmatch-based backup programs, like borg.
## Excludes based on Crashplan defaults (https://support.code42.com/CrashPlan/4/Troubleshooting/What_is_not_backing_up)
#
# Generic list
.DS_Store
*.swp
*.pyc
.Trash
.Xauthority
.bash_sessions
*/.[cC]ache
# Excludes based on Crashplan defaults (https://support.code42.com/CrashPlan/4/Troubleshooting/What_is_not_backing_up)
*.DS_Store
*.swp
*.pyc
.Trash
.Xauthority
.bash_sessions
.cache
**/.tmp
**/temp/
#!/bin/bash
admin="<email>"
site="<the site we need a cert for>"
dest="/etc/nginx/certs"
remote_file="https://acme.int.<domain>/$site/fullchain.cer"
local_file="$dest/$site-fullchain.cer"
# create local file if it doesnt exist
[ -f $local_file ] || touch -t 8001031305 $local_file
server {
listen 80;
listen 443;
server_name acme.int.<domain>;
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
include ssl-params.conf;
#!/bin/bash
MOUNTPATH=/Volumes/<somepath>
USERNAME=<user>
SERVER=<server>
KEYFILE=/home/<user>/.ssh/<keyfile>
if [ ! -d "$MOUNTPATH ]; then mkdir -p "$MOUNTPATH" ; fi
function mountdisk {
@joltcan
joltcan / gist:25a4fe53e28833d6eb34bad528ca3af8
Created October 5, 2017 08:03
SSH completion for known_hosts and config
function _own_ssh_known_hosts() {
perl -ne 'print "$1 " if /^([\w\d-\.]+).*$/i' ~/.ssh/known_hosts
}
function _own_ssh_hosts() {
perl -ne 'print "$1 " if /^host (.+)$/i' ~/.ssh/config
}
complete -W "$(_own_ssh_hosts)" ssh
complete -W "$(_own_ssh_known_hosts)" ssh
@joltcan
joltcan / Dockerfile-apache.txt
Last active March 29, 2017 07:35
Run apache as user in docker
RUN chown apache /run/httpd
RUN sed -i 's/Listen 80/Listen 8080/' /etc/httpd/conf/httpd.conf
RUN sed -ri \
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
/etc/httpd/conf/httpd.conf
USER apache
CMD ["/usr/sbin/httpd", "-DFOREGROUND"]
@joltcan
joltcan / grafana-pushbullet-proxy.php
Last active June 4, 2020 09:17
Simple php-curl post to Pushbullet as a wrapper for Grafana webhooks
<?php
// simple proxy from Grafana to Pushbullet. Bare minimum.
// please update Access-token to your liking. Feel free to use device_iden if
// you want to send to a specific device. Default is all.
// usage: example.com/pushbullet-proxy.php?title=test&body=testbody
// Find your token here: https://www.pushbullet.com/#settings/account
$access_token = '<my token>';
@joltcan
joltcan / ansible-icinga-hosts.cfg
Last active January 31, 2017 09:40
ansible jinja2 example for uniqe dict item (for icinga)
{% set app = "" %}
{% for dict_item in icinga.application_services %}
{% if dict_item['application'] != app %}
{% set app = dict_item['application'] %}
define host{
use generic-host
host_name {{ app }}
}
#!/bin/bash
# Copyright (C) 2016 Fredrik Lundhag - f@mekk.com
# Simple script to get VPS bandwidth usage into collectd with the exec plugin.
# Should work for all VPS providers that uses SolusVM for VPS control panel.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,