Skip to content

Instantly share code, notes, and snippets.

View frdmn's full-sized avatar
🦀

Jonas Friedmann frdmn

🦀
View GitHub Profile
@frdmn
frdmn / test.md
Last active January 16, 2019 14:31
Rocket.Chat REST API setType channel/group
  1. Obtain authentication token

    XHOST=rocketchat.dev.company.com:3000
    
    curl -H "Content-type:application/json" \
    	http://${XHOST}/api/v1/login \
    	-d '{ "username": "test", "password": "test" }'
  2. Store tokens in variable

@frdmn
frdmn / rocketchat-restore-admin-access-docker.md
Last active April 4, 2018 16:26
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
frdmn / rocket.service.js
Last active June 7, 2016 14:42
Alternative rocket.service.js for @galmok
//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 March 29, 2016 10:39
ssh-hosts.zsh plugin
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 March 19, 2016 13:47 — forked from infostreams/gogs
Debian startup (init.d) script for gogs.io
#! /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 / messages.yml
Created December 28, 2015 16:08
BanManager spanish translation - 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.
messages:
duplicateIP: '&cAdvertencia: [player] tiene la misma IP que los siguientes jugadores baneados:\n&6[players]'
@frdmn
frdmn / npm
Created December 21, 2015 13:42
vagrant@vagrant-ubuntu-trusty-64:~$ sudo su
root@vagrant-ubuntu-trusty-64:/home/vagrant# apt-get -y update
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://security.ubuntu.com trusty-security InRelease [64.4 kB]
Get:2 http://archive.ubuntu.com trusty-updates InRelease [64.4 kB]
Get:3 http://security.ubuntu.com trusty-security/main Sources [101 kB]
Get:4 http://archive.ubuntu.com trusty-backports InRelease [64.5 kB]
Hit http://archive.ubuntu.com trusty Release.gpg
Get:5 http://security.ubuntu.com trusty-security/universe Sources [31.9 kB]
Get:6 http://security.ubuntu.com trusty-security/main amd64 Packages [396 kB]
@frdmn
frdmn / checker.sh
Last active September 30, 2015 10:28
El Capitan availability checker - read the installation instructions in the bash script below
#!/usr/bin/env bash
# Installation instructions:
# $ curl -s https://gist.githubusercontent.com/frdmn/c6700ade5a0fc906271f/raw/checker.sh > /usr/local/bin/osx-checker
# $ chmod +x /usr/local/bin/osx-checker
# $ osx-checker
URL="https://itunes.apple.com/search?entity=macSoftware&term=OS+X"
SEARCH_STRING="OS X El Capitan"
TIMEOUT_IN_SECONDS="60"
@frdmn
frdmn / dirty-git-check
Last active August 29, 2015 14:14
This script checks every 5 minutes if your working git repo has any changed content and if so, it'll "wall" a message to all connected Terminal shells.
#!/usr/bin/env bash
repodir="/opt/minecraft/mc-yeahwhat/plugins"
wallmsgprefix="[git] [plugin-configs]"
wallmsg="${wallmsgprefix} Caution: there are changes in \"${repodir}\" that are not tracked. Make sure to add and commit them!"
tempfile=$(mktemp /tmp/git-dirty_XXXXXXX)
####
echo ${wallmsg} > ${tempfile}
@frdmn
frdmn / gist:62cfef5eb9f7c4408440
Last active August 29, 2015 14:11
convert text file to-utf8 bash function
function 2utf8(){
local tmp=$(mktemp)
iconv -f ISO-8859-1 -t UTF-8 $1 > $tmp
if [ -f $tmp ]; then
mv "$tmp" "$1"
fi
}