Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀

Jonas Friedmann frdmn

🦀
View GitHub Profile
@frdmn
frdmn / cleanup.sh
Created Aug 22, 2018
Clear Rocket.Chat uploads periodically (before #11236 [message pruning] existed)
View cleanup.sh
#!/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 <j@frd.mn>
# Requirements: mongo (cli), docker-compose, jq, tofrodos package
@frdmn
frdmn / icons.c
Created Mar 22, 2013
Custom MiniDLNA Apple icon - read more: http://blog.frd.mn
View icons.c
/* MiniDLNA media server
*
* This file is part of MiniDLNA.
*
* Penguin images are the creation of Larry Ewing (lewing@isc.tamu.edu) using The GIMP.
* NETGEAR images Copyright (c) 2008- NETGEAR, Inc. All Rights Reserved.
*
* MiniDLNA 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.
@frdmn
frdmn / rocketchat-restore-admin-access-docker.md
Last active Apr 4, 2018
Restore admin access in Rocket.Chat on Docker installations
View rocketchat-restore-admin-access-docker.md

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
frdmn / osx_free_equivalent.py
Created Dec 27, 2013
Python based `free` equivalent for OS X (Mavericks)
View osx_free_equivalent.py
#!/usr/bin/python
import subprocess
import re
# Get process info
ps = subprocess.Popen(['ps', '-caxm', '-orss,comm'], stdout=subprocess.PIPE).communicate()[0]
vm = subprocess.Popen(['vm_stat'], stdout=subprocess.PIPE).communicate()[0]
# Iterate processes
@frdmn
frdmn / lc-mailpath
Last active Nov 17, 2016
LiveConfig mail path lookup
View lc-mailpath
#!/bin/bash
###############################################################
# LiveConfig mail path lookup by Jonas Friedmann (iWelt AG) #
# j@frd.mn #
# http://frd.mn #
# http://twitter.com/frdmn #
###############################################################
STRING=${1}
@frdmn
frdmn / rocket.service.js
Last active Jun 7, 2016
Alternative rocket.service.js for @galmok
View rocket.service.js
//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({
name:'Rocket.Chat',
description: 'Rocket.Chat Service',
@frdmn
frdmn / ssh-hosts.zsh
Created Mar 29, 2016
ssh-hosts.zsh plugin
View ssh-hosts.zsh
h=()
if [[ -r ~/.ssh/config ]]; then
h=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
fi
if [[ -r ~/.ssh/known_hosts ]]; then
h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null
fi
if [[ $#h -gt 0 ]]; then
zstyle ':completion:*:ssh:*' hosts $h
zstyle ':completion:*:slogin:*' hosts $h
@frdmn
frdmn / gogs
Last active Mar 19, 2016 — forked from infostreams/gogs
Debian startup (init.d) script for gogs.io
View gogs
#! /bin/sh
### BEGIN INIT INFO
# 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
### END INIT INFO
@frdmn
frdmn / doge.user.js
Created Dec 24, 2013
DogeCoin beautifier. Many Comic Sans. Much esthetic. Wow. — Moved to userscripts.org/scripts/show/186970
View doge.user.js
// ==UserScript==
// @name DogeCoin beautifier
// @version 0.2
// @author frdmn
// @description Such ComicSans. Wow.
// @match *://*/*
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
@frdmn
frdmn / mininginfo
Last active Jan 1, 2016
Simple bash script to get the latest Informations of your Altcoin Mining workers based on the MPOS API (which is probably used by 95% of the pools out there)
View mininginfo
#!/bin/bash
# MPOS Hostname
config_host="miningpool.org"
# MPOS API token (Login -> Edit Account -> API Key)
config_api="0123456789abcdefghijklmnopqrstuvwxyzaaabacadaeafagahaiajakalaman"
json=$(curl -s "http://${config_host}/index.php?page=api&action=getuserstatus&api_key=${config_api}" | python -m json.tool)
parse_hashrate=$(echo "$json" | python -m json.tool | grep "hashrate" | awk '{ print $2 }' | sed 's/,//g')
You can’t perform that action at this time.