Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀

Jonas Friedmann frdmn

🦀
View GitHub Profile
@frdmn
frdmn / keys.pub
Created Aug 18, 2020
frdmn@github - keys.pub
View keys.pub
BEGIN MESSAGE.
EEGErlKyZxOo4VB kevDbZUEJAKrBDB R20P7l03WuMQcBL YELNpEd6pHSK0Ng
rELQG5zby40L7QO FwKs4uB8e83TCKq 6Xr2MZHgg6oYWic lco69PQeA8YqJel
dc4vyMPo8DNbKMT IfoxAFXppc4Frfl 8OE60qwf1IcLNGn gAHSdzQRYfjwayL
bgm5HNUb0f7EJJV DvyzY9wmIdIvIMx mGPQj.
END MESSAGE.
@frdmn
frdmn / bash_aliases
Last active Mar 8, 2020
Nginx and PHP-FPM configuration + default virtual host
View bash_aliases
alias nginx.start='sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.stop='sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.restart='nginx.stop && nginx.start'
alias php-fpm.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist"
alias php-fpm.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist"
alias php-fpm.restart='php-fpm.stop && php-fpm.start'
alias mysql.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
alias mysql.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
alias mysql.restart='mysql.stop && mysql.start'
alias nginx.logs.error='tail -250f /usr/local/etc/nginx/logs/error.log'
@frdmn
frdmn / reddit-outage-refresh.user.js
Created Dec 31, 2013
Reddit outage refresh - UserScript which adds auto refresh on the "we took too long to make this page for you - try again and hopefully we will be fast enough this time." outage page of Reddit. No need for firing CMD+R anymore.
View reddit-outage-refresh.user.js
// ==UserScript==
// @name Reddit outage refresher
// @version 0.1
// @author frdmn
// @match http://www.reddit.com/*
// ==/UserScript==
var xpathResult = document.evaluate("(//text()[contains(., 'try again and hopefully we will be fast enough this time.')])[1]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
var node=xpathResult.singleNodeValue;
if (node!=null) {
@frdmn
frdmn / osx-10-10-virtualbox.md
Last active Jan 18, 2020
Install OS X 10.10 Yosemite in VirtualBox
View osx-10-10-virtualbox.md
@frdmn
frdmn / clients.c
Created Apr 21, 2013
MiniDLNA update interval patch
View clients.c
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "clients.h"
#include "getifaddr.h"
#include "log.h"
struct client_type_s client_types[] =
{
@frdmn
frdmn / readme.md
Created Apr 19, 2018
Install imapsync from source on Ubuntu 16.04
View readme.md
  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 https://github.com/imapsync/imapsync.git
View LICENSE
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
frdmn / README.md
Last active Jan 22, 2019
Victor's macOS Client information parser
View README.md
  1. Download the client-information and move it to /usr/local/bin/client-information:

    wget https://gist.githubusercontent.com/frdmn/5eeebc05c61c7a00450aee8b81be824c/raw/520d3e9ae9ec80710344119e1780939fa843130b/client-information -O /usr/local/bin/client-information
    bash +x /usr/local/bin/client-information
    
  2. Configure the scheduler to periodically run the script:

@frdmn
frdmn / test.md
Last active Jan 16, 2019
Rocket.Chat REST API setType channel/group
View test.md
  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 / 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
You can’t perform that action at this time.