Skip to content

Instantly share code, notes, and snippets.

@phunehehe
phunehehe / logrotate.conf
Last active December 20, 2015 03:09
A nice starting point for a logrotate config file
/path/to/*.log {
size 10M
rotate 10
create
compress
delaycompress
dateext
dateformat -%Y%m%d-%s
}
#!/bin/bash
grep nrpe /var/log/audit/audit.log | audit2allow -M local
semodule -i local.pp
$ tree /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0
/nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0
├── bin
│   ├── aox -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/bin/aox
│   ├── aoxdeliver -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/bin/aoxdeliver
│   ├── aoxexport -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/bin/aoxexport
│   ├── aoximport -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/bin/aoximport
│   ├── archiveopteryx -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/sbin/archiveopteryx
│   ├── logd -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/sbin/logd
│   └── recorder -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/sbin/recorder
@phunehehe
phunehehe / modules
Created November 5, 2013 09:28
Manage Chef modules
name;/path/to/name
#!/bin/bash
set -e
monthday="$(date +%-d)"
weekday="$(date +%w)"
if [[ "$monthday" -eq 1 ]]
then
@phunehehe
phunehehe / MyFormModel.php
Last active December 30, 2015 05:59
Antispam for Yii form
<?php
/*
* Prevent automated POST (actually non-GET) requests by checking a form
* attribute set by JavaScript, in the hope that spammers will not execute
* JavaScript.
*
* Usage:
* 1. Extend MyFormModel instead of CFormModel
* class ContactForm extends MyFormModel {}
for i in $(virsh list | grep running | awk '{print $2}')
do
virsh autostart $i
done
for i in $(virsh list --all | grep 'shut off' | awk '{print $2}')
do
virsh autostart --disable $i
done
[twistd]
user munin
@phunehehe
phunehehe / mutt-ses.md
Last active March 7, 2018 02:10
Settings for Mutt to test SES

Change the email address to the verified sender address. By default Mutt doesn't use the envelope address, resulting in the email getting rejected because of unverified address.

set from = 'Amazing Tester <tester@amazing.com>'
set smtp_pass = 'xxx'
set smtp_url = 'smtps://xxx@email-smtp.xxx.amazonaws.com'
set use_envelope_from = yes
resource aws_elasticache_replication_group single {
node_type = "cache.m3.medium"
number_cache_clusters = 1
port = 6379
replication_group_description = "single-test"
replication_group_id = "single-test"
subnet_group_name = "staging"
}
resource aws_elasticache_replication_group cluster {