Skip to content

Instantly share code, notes, and snippets.

View kawaii's full-sized avatar
mediocre programmer

Kane Valentine kawaii

mediocre programmer
View GitHub Profile
@kawaii
kawaii / movim.conf
Created December 24, 2020 16:06
Example nginx configuration for Movim Docker deployment
upstream movim-http {
server movim:9000;
}
upstream movim-ws {
server movim:8080;
}
fastcgi_cache_path /tmp/nginx_cache levels=1:2 keys_zone=nginx_cache:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";

general

  • admins can configure 'slots' which users can equip items from their inventory into
  • a default set of slots are provided, with a default UI (head, torso, legs, feet, hands, main hand, off-hand, neck, ring)
  • items are given an equipable flag, and if set allows selection of which slot they fit
  • items can trigger certain conditionals when equipped (i.e. you need X posts to wear this, you need X and Y reputation, usergroup needed)
  • item slot UI inspired by OldSchool RuneScape (https://oldschool.runescape.wiki/images/1/12/Worn_equipment_tab.png?c4bec)
  • items can trigger arbitrary scripts on equip/unequip (i.e. add the user to a group on equip, remove them from it on unequip)
  • in the future, items will/can optionally provide 'stats' to users when worn i.e. my %stat-boosts = attack => 4, speed => -2;
  • some items may prevent another slot from being used (i.e. my really big heavy sword uses both main hand and off-hand slots)

general

  • allows users to earn awards, which are then displayed on their postbit and user profile pages
  • exposes a new page at /misc.php?action=awards, listing award categories and an icon, description and recipients counter
  • exposes pages at /misc.php?action=awards&id=X per award listing each recipient, the reason they were granted the award and the date recieved
  • provide users with an award cp panel, allowing them to see a list of their current awards, and provided they have permission to do so - hide/change the postbit display order of their awards
  • certain awards can be made immune to user-interference, i.e. cannot be hidden
  • hiding an award only removes it from the postbit, it is still listed on their profile pages and the award recipient list
  • reordering of awards only applies to the postbit, they are displayed by date acending on profile pages
  • each award icon on postbit and profiles is a hyperlink to the award recipients list of that particular award - with an html anchor which hi
@kawaii
kawaii / default.conf
Created February 7, 2020 10:38
An nginx virtual host configuration file, for use with the MyBB Docker distribution.
upstream mybb {
server mybb:9000 weight=5;
}
server {
listen 80;
root /var/www/html;
index index.html index.php;
version: '3.7'
services:
mybb:
image: mybb/mybb:1.8.22
environment:
restart: on-failure
volumes:
- ${PWD}/mybb:/var/www/html
nginx:
@kawaii
kawaii / docker-swarm-ceph-v1.md
Last active February 7, 2019 19:27
Kane's Christmas adventures in Docker Swarm storage with CEPH.

This document goes into depth on my experiments with deploying a Docker Swarm with a CEPH block storage cluster as a backend for volumes and persistent data. We'll be using what appears to be the latest stable release of CEPH, v13.2.2 "Mimic". This was a fairly mind-numbing procedure to learn and perfect, CEPH's documentation is quite complicated (maybe I'm just dumb).

Prerequisites

Here's what I deployed in the morning before setting up the cluster;

  • x5 Debian 9.6 VMs each with 1 vCPU and 1024MB of RAM
  • each VM is named sequentially, cpu-01 through to cpu-05
  • preconfigure your ssh config and Salt roster files if you need to
  • a spare, /dev/vdb 10GB block device attached to each VM
  • Docker Swarm deployed with 3 managers and 2 workers
@kawaii
kawaii / perl-one-liner.sh
Created February 5, 2018 15:18
List of Perl one-liners for doing various things.
# change home directories to UIDs in an LDIF file
perl -0777 -p -i.bak -e's{homeDirectory: .+?$(.*?uidNumber: (\d+))}{homeDirectory: /home/$2$1}msg' ou-test.ldif
@kawaii
kawaii / movim-stickers.md
Last active July 6, 2017 08:03
How to add custom sticker packs to Movim

How to add custom sticker packs to Movim

Movim is a decentralized social network, written in PHP and HTML5 and based on the XMPP standard protocol. One of my faviourite features in Movim is that you can send stickers to your friends. By default Movim comes bundled with a few sticker packs but if like me you'd like to extend this and add your own then it's surprisingly not too difficult! There are three main components to creating your own sticker pack:

You'll need to find the following directory on your Movim server filesystem:

/var/www/movim/app/widgets/Stickers/stickers/

Within this directory you will see the default Movim sticker packs i.e. 'mochi' and 'racoon'. Create a new directory here, for this example call it 'mystickers' or something. Within this directory create a new file called 'info.ini'. The contents of this file describe some basic information about the sticker pack. Here is an example from the 'racoon' set:

@kawaii
kawaii / mybb-systemd.md
Last active June 18, 2017 00:01
How to setup systemd timers for your MyBB task system.

Create the following two files in your /etc/systemd/system/ directory:

mybb.service:

[Unit]
Description=MyBB Tasks

[Service]
User=www-data
ExecStart=/usr/bin/php /var/www/mybb/task.php

ANONYMOUS POSTING - 2017-03-03

  • Core edit commited to private Ikigai repository (kawaii/ikigai.git) on GitHub
  • Allows users to check a 'Post Anonymously' option when creating a new thread/post (here: https://i.imgur.com/GFBSJDS.png)
  • Option to select an array of forum IDs in which the feature can be used by all usergroups
  • Option to select an array of group IDs which can use the feature in any forum ID they like
  • Posts will appear as posted by user 'Anonymous' with set avatar /images/anonymous.png)
  • Anyone with the permission canmodcp or cancp has the ability to permenantly unmask (or re-mask) an anonymous post
  • Anyone with the permission canmodcp or cancp can view the creator of a post using /misc.php?action=anonymous&pid={POST ID}
  • /misc.php?action=anonymous&pid={POST ID} will redirect directly to the profile of the user who made the post, or error if the POST ID is not anonymous