Skip to content

Instantly share code, notes, and snippets.

0
group_attrs = ["name", "member"]
group_base = "<%= @ldap_linux_groupbase -%>"
user_filter = Net::LDAP::Filter.present("sAMAccountName")
user_attrs = ["sAMAccountName"]
ldap.search(:base => group_base, :filter => group_filter, :attributes => group_attrs) do |group|
if mapping[group.name.first]
groupright = mapping[group.name.first]
group.member.each do |member|
ldap.search(:base => member, :filter => user_filter, :attributes => user_attrs) do |user|
if !rights[user.sAMAccountName.first]
REWRITTEN_WORKING_COPY_DIR=/tmp/hiera
git pull $REWRITTEN_WORKING_COPY_DIR--allow-unrelated-histories
git push --force origin HEAD:production
PREFIX=data
SQL=/tmp/rewrite-history.sql
:>$SQL
git filter-branch \
--index-filter '
git ls-files -s |
sed "s,\t,&'"$PREFIX"'/," |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info &&
@cite
cite / parse-rss.sh
Created September 29, 2013 10:24
Parse RSS feed with xmlstarlet
#/bin/bash
entrydir=/tmp/rss-entries
xmlstarlet sel -t -m "//item/title" -v . -n $1 | while read title; do
entryhash=$(echo $title | md5sum | awk '{print $1}')
xmlstarlet sel -t -m "//item[title='$title']" -c . $1 > $entrydir/$entryhash
done
@cite
cite / nginx.conf
Last active June 25, 2020 16:45
SSL/SNI for s9y blog.
# HTTP server for redirects only
server {
server_name www.incertum.net incertum.net www.stefan-foerster.de stefan-foerster.de;
listen 80 default_server;
listen [::]:80 ipv6only=on default_server;
return 301 https://$host$request_uri;
}
@cite
cite / nginx.conf
Created September 20, 2013 10:49
Mailman with nginx and fcgiwrap
# lists.example.net definition
server {
server_name lists.example.net;
listen 80;
listen [::]:80;
root /var/www/lists;
index index.html;
access_log /var/log/nginx/access-lists.example.net.log;
@cite
cite / openssh
Last active December 22, 2015 23:49
DANE TLSA and SSHFP
ssh -o "VerifyHostKeyDNS ask" thrassa.incertum.net
The authenticity of host 'thrassa.incertum.net (78.47.238.19)' can't be established.
RSA key fingerprint is 13:0f:0e:4e:2c:1a:ab:5d:55:55:2a:86:37:93:7e:b9.
**Matching host key fingerprint found in DNS.**
Are you sure you want to continue connecting (yes/no)?
@cite
cite / gallery3.conf
Last active February 10, 2021 19:38
nginx/php-fpm configuration for Gallery3.
[gallery3]
user = vhost-user
group = vhost-group
listen = /tmp/gallery3-example-com.sock
listen.group = www-data
listen.mode = 0660
pm = dynamic
pm.max_children = 5
pm.min_spare_servers = 1