Skip to content

Instantly share code, notes, and snippets.

@jhass
jhass / git-merge-diaspora-stable
Last active April 11, 2021 12:26
Little helper to merge pull requests to the stable for diaspora/diaspora. Handy alias: git config alias.mds merge-diaspora-stable
#!/bin/bash
set -e
if [ -z "$1" ]; then
echo "No PR given"
exit 1
fi
parts=(${1//\// })
pr=${parts[${#parts[@]}-1]}
@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
@jhass
jhass / server.cr
Created July 22, 2016 12:05
Simple debug HTTP server in Crystal
require "option_parser"
require "http/server"
require "json"
class Settings
property port = 3000
property host = "127.0.0.1"
property? show_headers = false
property? show_raw_json = false
end
@jhass
jhass / fix_constraints.sql
Last active December 4, 2020 13:03
Fix missing on delete cascade on foreign key constraints after migrating Diaspora to PostgreSQL
ALTER TABLE aspect_memberships
DROP CONSTRAINT aspect_memberships_aspect_id_fkey,
ADD CONSTRAINT aspect_memberships_aspect_id_fkey FOREIGN KEY (aspect_id) REFERENCES aspects(id) ON DELETE CASCADE;
ALTER TABLE aspect_memberships
DROP CONSTRAINT aspect_memberships_contact_id_fkey,
ADD CONSTRAINT aspect_memberships_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES contacts(id) ON DELETE CASCADE;
ALTER TABLE aspect_visibilities
DROP CONSTRAINT aspect_visibilities_aspect_id_fkey,
ADD CONSTRAINT aspect_visibilities_aspect_id_fkey FOREIGN KEY (aspect_id) REFERENCES aspects(id) ON DELETE CASCADE;
ALTER TABLE comment_signatures
@jhass
jhass / gh-pr-status.rb
Last active June 20, 2020 11:22
Little script to list your pull requests and whether you need to take action on them
#!/usr/bin/env ruby
# frozen_string_literal: true
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "octokit"
gem "terminal-table"
@jhass
jhass / README.md
Last active May 14, 2020 13:16
Crystal shim to redirect malloc & pthread to bdwgc (depends on glibc and https://github.com/jhass/crystal/tree/function_pointer_fixes)
@jhass
jhass / .ssh_authorized_keys
Last active May 17, 2019 08:46
Git shell only for specific SSH key
command="/home/USER/.ssh/git-shell",no-port-forwarding,no-X11-forwarding,no-pty ssh-rsa YOUR_KEY foo
@jhass
jhass / mod_auth_diaspora.lua
Last active March 15, 2018 13:14
Prosody authentication for Diaspora. Tested with Prosody 0.9.4. See https://wiki.diasporafoundation.org/Integration/XMPP/Prosody
-- Based on Simple SQL Authentication module for Prosody IM
-- Copyright (C) 2011 Tomasz Sterna <tomek@xiaoka.com>
-- Copyright (C) 2011 Waqas Hussain <waqas20@gmail.com>
--
-- 25/05/2014: Modified for Diaspora by Anahuac de Paula Gil - anahuac@anahuac.eu
-- 06/08/2014: Cleaned up and fixed SASL auth by Jonne Haß <me@jhass.eu>
-- 22/11/2014: Allow token authentication by Jonne Haß <me@jhass.eu>
local log = require "util.logger".init("auth_diaspora")
local new_sasl = require "util.sasl".new
/*
* 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 / Gemfile
Last active August 7, 2017 14:03
Simple rack redirect app
source "https://rubygems.org"
ruby "2.0.0"
gem 'rack'
gem 'puma'
group :development do
gem 'foreman'
end