Skip to content

Instantly share code, notes, and snippets.

@jhass
jhass / diaspora.conf
Last active March 12, 2021 13:18
Advanced Diaspora Apache reverse proxy
# Make sure to notice the comments at https://gist.github.com/jhass/719014#gistcomment-19774
<VirtualHost *:80>
ServerName diaspora.example.org
ServerAlias www.diaspora.example.org
RedirectPermanent / https://diaspora.example.org/
</VirtualHost>
<VirtualHost *:443>
ServerName diaspora.example.org
<?xml version='1.0' encoding='UTF-8'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'
xmlns:hm='http://host-meta.net/xrd/1.0'>
<hm:Host>mrzyx.de</hm:Host>
<Link rel='lrdd'
template='https://mrzyx.de/webfinger.php?q={uri}'>
<Title>Resource Descriptor</Title>
</Link>
</XRD>
@jhass
jhass / nginx.conf
Last active May 12, 2022 02:13
Nginx Diaspora reverse proxy. - This is not a complete Nginx configuration! It only shows the relevant parts for integrating Diaspora.
# This is not a complete Nginx configuration! It only shows the relevant parts for integrating Diaspora.
# [...]
http {
# Your standard server configuration goes here
# [...]
gzip_static on;
@jhass
jhass / follow_all.rb
Created November 16, 2011 11:08
Add all followers to an aspect, edit and save under script/follow_all.rb, run with bundle exec ruby ./script/follow_all.rb
#!/usr/bin/env ruby
user_id = 0 # your user id
aspect_name = "Work" # Name of the aspect followers should be added to
require File.join(File.dirname(File.expand_path(__FILE__)), '..', 'config', 'environment')
user = User.find(user_id)
aspect = user.aspects.where(:name => aspect_name).first
user.contacts.only_sharing.each do |contact|
begin
user.share_with(contact.person, aspect)
@jhass
jhass / yml-checker.rb
Created December 30, 2011 17:53
Simple script that tries to load it's arguments as YAML files. Don't forget to chmod +x it.
#!/usr/bin/env ruby
require 'yaml'
files = ARGV
if !files.nil? && files.length >= 1
files.each do |file|
if File.exists?(file) && File.file?(file)
begin
print "checking #{file}..."
@jhass
jhass / Diaspora-PKGBUILD.md
Last active September 29, 2015 18:37
A PKGBUILD for Diaspora (git release)
/*
* Copyright (C) 2004-2009 See the AUTHORS file for details.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*
* Made by Mini
*/
@jhass
jhass / fortune
Created May 21, 2012 14:41
Random fortune cookie
#!/usr/bin/env python
# -*- coding: utf8
from random import choice
fortunes = ["“Welcome” is a powerful word.",
"A dubious friend may be an enemy in camouflage.",
"A feather in the hand is better than a bird in the air. (2)",
"A fresh start will put you on your way.",
"A friend asks only for your time not your money.",
"A friend is a present you give yourself.",
"A gambler not only will lose what he has, but also will lose what he doesn’t have.",
@jhass
jhass / gpio_functions.sh
Created July 7, 2012 13:04
Some helper functions to work with the GPIO ports of the RPi
function export() {
echo "$1" | sudo tee /sys/class/gpio/export
sudo chgrp -RH --dereference users /sys/class/gpio/*
sudo chmod -R g+w+r /sys/class/gpio/*/*
}
function unexport() {
echo "$1" | sudo tee /sys/class/gpio/unexport
}
#!/usr/bin/env ruby
require './config/environment'
def path_length(post, length=0)
if post.is_a?(Reshare)
path_length(post.root, length+1)
else
length
end
end