Skip to content

Instantly share code, notes, and snippets.

Jonas Friedmann frdmn

Block or report user

Report or block frdmn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
The MIT License (MIT)
Copyright (c) 2019 Jonas Friedmann
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
frdmn /
Last active Jan 22, 2019
Victor's macOS Client information parser
  1. Download the client-information and move it to /usr/local/bin/client-information:

    wget -O /usr/local/bin/client-information
    bash +x /usr/local/bin/client-information
  2. Configure the scheduler to periodically run the script:

frdmn /
Created Aug 22, 2018
Clear Rocket.Chat uploads periodically (before #11236 [message pruning] existed)
#!/usr/bin/env bash
# Script to remove old uploads in Rocket.Chat instances for people using the filesystem storage method.
# This script makes sure to NOT remove users avatars. Because they are stored in the same directory we
# have to query the Mongo to check if a file is a regular file upload or a avatar.
# Env vars:
# - DELETE_OLDER_THAN_DAYS (defaults to 5)
# Written by: Jonas "frdmn" Friedmann <>
# Requirements: mongo (cli), docker-compose, jq, tofrodos package
frdmn /
Created Apr 19, 2018
Install imapsync from source on Ubuntu 16.04
  1. Install requirements and dependencies:

    apt install git cpanminus automake build-essential libauthen-ntlm-perl libclass-load-perl libcrypt-openssl-rsa-perl libdata-uniqid-perl libdate-manip-perl libdigest-hmac-perl libdigest-md5-file-perl libdist-checkconflicts-perl libfile-copy-recursive-perl libio-tee-perl libjson-perl libmail-imapclient-perl libmodule-implementation-perl libmodule-runtime-perl libmodule-scandeps-perl libpackage-stash-perl libpackage-stash-xs-perl libpar-packer-perl libreadonly-perl libsys-meminfo-perl libterm-readkey-perl libtest-fatal-perl libtest-mock-guard-perl libtest-mockobject-perl libtest-pod-perl libtest-requires-perl libtry-tiny-perl libunicode-string-perl make makepasswd perl-doc rcs
  2. Clone source code from git repository

    git clone
frdmn /
Last active Jan 16, 2019
Rocket.Chat REST API setType channel/group
  1. Obtain authentication token
    curl -H "Content-type:application/json" \
    	http://${XHOST}/api/v1/login \
    	-d '{ "username": "test", "password": "test" }'
  2. Store tokens in variable

frdmn /
Last active Apr 4, 2018
Restore admin access in Rocket.Chat on Docker installations

Open Mongo shell within Mongo container

Change into docker-compose directory (where your docker-compose.yml is located):

cd /opt/docker/Rocket.Chat
docker-compose run mongo bash

Make sure to replace mongo with your MongoDB container name in case you use a different one.

frdmn / rocket.service.js
Last active Jun 7, 2016
Alternative rocket.service.js for @galmok
View rocket.service.js
var Service = require('node-windows').Service;
var EventLogger = require('node-windows').EventLogger;
var logger = new EventLogger('Rocket.Chat');
// Create a new service object
var svc = new Service({
description: 'Rocket.Chat Service',
frdmn / ssh-hosts.zsh
Created Mar 29, 2016
ssh-hosts.zsh plugin
View ssh-hosts.zsh
if [[ -r ~/.ssh/config ]]; then
h=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
if [[ -r ~/.ssh/known_hosts ]]; then
h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null
if [[ $#h -gt 0 ]]; then
zstyle ':completion:*:ssh:*' hosts $h
zstyle ':completion:*:slogin:*' hosts $h
frdmn / gogs
Last active Mar 19, 2016 — forked from infostreams/gogs
Debian startup (init.d) script for
View gogs
#! /bin/sh
# Provides: gogs
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Git repository manager Gogs
# Description: Starts and stops the self-hosted git repository manager Gogs
frdmn / messages.yml
Created Dec 28, 2015
BanManager spanish translation - messages.yml
View messages.yml
# Variables
# [reason] = Motivo del baneo y el silenciamiento.
# [player] = Nombre del jugador.
# [ip] = IP baneada.
# [actor] = Aquél que baneo o silenció a un jugador.
# [expires] = Tiempo de duración de un baneo o silenciamiento.
# NOTA: ban y mute no tienen una traducción y/o al menos no una traducción muy exacta al español. Puede que la traducción en este archivo no sea 100% precisa.
duplicateIP: '&cAdvertencia: [player] tiene la misma IP que los siguientes jugadores baneados:\n&6[players]'
You can’t perform that action at this time.