Skip to content

Instantly share code, notes, and snippets.

View Finkregh's full-sized avatar
🚲

Oluf Lorenzen Finkregh

🚲
View GitHub Profile
curl -XPUT "http://localhost:9200/graylog2/message/_mapping" -d'{"message": {"_ttl" : { "enabled" : true, "default" : "7d" }}}'
# 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 / {
@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
@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
#
# 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 / 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
#!/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/"
#!/bin/bash
#
# btrfs-snap - make periodic snapshots of btrfs filesystem
#
# Copyright (C) 2010 Birger Monsen [email protected]
#
# This program is distributed under the GNU General Public License
# http://www.gnu.org/licenses/gpl.txt
#
# Reverse the order of all intervals from /etc/rsnapshot.conf
#interval hourly 3
#interval daily 7
#interval weekly 4
##interval monthly 3
#
# all single commands below should be possible to be scripted within a bash loop
# by defining a function called interval and a process afterwards..
# to get all defined intervals from /etc/rsnapshot you can use grep