Skip to content

Instantly share code, notes, and snippets.

View Finkregh's full-sized avatar
🚲

Oluf Lorenzen Finkregh

🚲
View GitHub Profile
#!/bin/bash
#
# btrfs-snap - make periodic snapshots of btrfs filesystem
#
# Copyright (C) 2010 Birger Monsen birger@birger.sh
#
# This program is distributed under the GNU General Public License
# http://www.gnu.org/licenses/gpl.txt
#
#!/bin/sh
sudo rsync -aHXh --delete "/.snapshot/`ls -v1 /.snapshot | grep daily | tail -n1`/" "/home/alerticus/mnt/sata/backup/alerticus-thinkpad/root/"
sudo rsync -aHXh --delete "/home/.snapshot/`ls -v1 /home/.snapshot | grep daily | tail -n1`/" "/home/alerticus/mnt/sata/backup/alerticus-thinkpad/home/"
@Finkregh
Finkregh / create-prosody-groups.sh
Created December 6, 2013 11:15
add groups from Active Directory / ldap to prosody
#!/bin/bash
#/usr/local/bin/create-prosody-groups.sh
tmpfile=/tmp/sharedgroups.txt
for org in group1 group2 ; do echo "[${org}]" ; ldapsearch -x -h ldap.corp.org -D "ldap-bind-user" -w "ldap-bind-pw" -LLL -b "ou=${org},dc=corp,dc=org" "(&(objectClass=user)(mail=*))" | grep -E "^cn: |sAMAccountName: "; done > ${tmpfile}
while read line ; do
if echo ${line} | grep -qE "^\[" ; then
#
# A CORS (Cross-Origin Resouce Sharing) config for nginx
#
# == Purpose
#
# This nginx configuration enables CORS requests in the following way:
# - enables CORS just for origins on a whitelist specified by a regular expression
# - CORS preflight request (OPTIONS) are responded immediately
# - Access-Control-Allow-Credentials=true for GET and POST requests
@Finkregh
Finkregh / psync.sh
Created January 12, 2014 15:33 — forked from mkaito/psync.sh
# {{{ Android phone sync (PS) and backup
PS_BACKUP_DIR=~/Android/Backup # Where to keep backups
PS_BACKUP_KEEP=60 # Days to keep backups
PS_BACKUP_ENCRYPT_TO="0x00000000" # GPG key ID to sign and encrypt to
PS_IP="192.168.0.100" # The IP your device will be found at
PS_SSH="Nexus" # The SSH host of your phone, or an SSH alias
PS_STAGING=~/Android/Sync # The staging folder for sync, sans trailing slash
PS_SDCARD=/sdcard # The sync root on the phone, sans trailing slash
PS_RSYNC_OPT="-vzuLr --no-perms" # Extra options to pass to rsync
@Finkregh
Finkregh / damazon.py
Created February 23, 2014 11:01 — forked from trehn/damazon.py
#!/usr/bin/python
# setup: pip install requests beautifulsoup4
from decimal import Decimal
import requests
from bs4 import BeautifulSoup
import sys
import getpass
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
curl -XPUT "http://localhost:9200/graylog2/message/_mapping" -d'{"message": {"_ttl" : { "enabled" : true, "default" : "7d" }}}'
@Finkregh
Finkregh / keybase.md
Created October 9, 2014 18:44
keybase.md

Keybase proof

I hereby claim:

  • I am finkregh on github.
  • I am finkregh (https://keybase.io/finkregh) on keybase.
  • I have a public key whose fingerprint is 327E 822C 5533 8A8A 51AF 2CC4 FFC0 1051 DEE0 B735

To claim this, I am signing this object: