Skip to content

Instantly share code, notes, and snippets.

View frdmn's full-sized avatar
🦀

Jonas Friedmann frdmn

🦀
View GitHub Profile
@frdmn
frdmn / icons.c
Created March 22, 2013 16:03
Custom MiniDLNA Apple icon - read more: http://blog.frd.mn
/* 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 / clients.c
Created April 21, 2013 13:30
MiniDLNA update interval patch
#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 / cloudbot
Created September 16, 2013 13:58
SysVinit start up daemon for CloudBot --- touch /etc/init.d/cloudbot && chmod 700 /etc/init.d/cloudbot && vi /etc/init.d/cloudbot
#!/bin/sh
### BEGIN INIT INFO
# Provides: cloudbot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: SysVinit start up daemon for CloudBot
# Description: Start up daemon for CloudBot
@frdmn
frdmn / index.php
Created November 13, 2013 08:02
Subreddit HTML export/lister
<ul>
<?php
# Subreddit HTML export
#
# Log into Reddit and browse to "http://www.reddit.com/reddits.json"
# Save the content with the filename "reddits.json" and place it besides
# this file in the same directory.
$json = file_get_contents("./reddits.json");
$json = json_decode($json, true);
@frdmn
frdmn / mov2gif.md
Last active December 28, 2015 15:59
Bash function for OS X to convert a .mov file into a .gif but in a reasonable quality.

mov2gif converter

Bash function for OS X to convert a .mov file into a .gif but in a reasonable quality.

Demonstration

.mov example (414 KB)

Click here for a example .mov

@frdmn
frdmn / maven3-brew.sh
Created November 20, 2013 11:48
Install maven3 on OS X 10.9+ via homebrew formula
# In case you run 10.9, there is no maven3 on board by default, and "brew install maven" will fail, so here's a workaround:
brew install https://raw.github.com/Homebrew/homebrew-versions/master/maven30.rb
@frdmn
frdmn / bash_aliases
Last active November 13, 2023 17:47
Nginx and PHP-FPM configuration + default virtual host
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 / mininginfo
Last active January 1, 2016 04:49
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)
#!/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')
@frdmn
frdmn / doge.user.js
Created December 24, 2013 15:18
DogeCoin beautifier. Many Comic Sans. Much esthetic. Wow. — Moved to userscripts.org/scripts/show/186970
// ==UserScript==
// @name DogeCoin beautifier
// @version 0.2
// @author frdmn
// @description Such ComicSans. Wow.
// @match *://*/*
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
@frdmn
frdmn / osx_free_equivalent.py
Created December 27, 2013 09:06
Python based `free` equivalent for OS X (Mavericks)
#!/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