Skip to content

Instantly share code, notes, and snippets.

View martin-juul's full-sized avatar
🇩🇰
Coding

Martin Juul martin-juul

🇩🇰
Coding
View GitHub Profile
@martin-juul
martin-juul / custom-crunch.zsh-theme
Last active March 17, 2018 22:05
[Custom crunch theme with user@host prompt] #zsh-theme #zsh
# CRUNCH - created from Steve Eley's cat waxing.
# Initially hacked from the Dallas theme. Thanks, Dallas Reedy.
# Modified by Snowy
#
# This theme assumes you do most of your oh-my-zsh'ed "colorful" work at a single machine,
# and eschews the standard space-consuming user and hostname info. Instead, only the
# things that vary in my own workflow are shown:
#
# * User & Host
# * The RVM version and gemset (omitting the 'ruby' name if it's MRI)
@martin-juul
martin-juul / DarkerNZBget.sh
Created May 15, 2018 14:51
Fixed version of DarkerNZBget (developer branch) for usage with docker
#!/usr/bin/env bash
#
# DarkerNZBGet theme installer
#
# Version history
# v1.2.0 - 03/28/2018 - Added icon color prompt option and code to copy over the corresponding PNG file.
# v1.1.3 - 03/28/2018 - Added cleanup functionality and made some functions more efficient.
# v1.1.2 - 03/28/2018 - Added additional options checks.
# v1.1.1 - 03/27/2018 - Added functionality to ensure provided Docker container exists on the Server.
# v1.1.0 - 03/27/2018 - Added functionality to install theme to Docker containers.

docker update --memory "1g" --cpuset-cpu "1" <RunningContainerNameOrID> this will update the "RunningContainerNameOrId" to use 1g of memory and only use cpu core 1

To up date all running containers to use core 1 and 1g of memory:

docker update --cpuset-cpus "1" --memory "1g" $(docker ps | awk 'NR>1 {print $1}')

https://stackoverflow.com/a/39152553

@martin-juul
martin-juul / install-ffmpeg-brew.sh
Created July 24, 2018 14:31
Install ffmpeg with all extras on macOS with Homebrew
#!/usr/bin/env bash
brew install ffmpeg $(brew options ffmpeg | grep -vE '\s' | grep -- '--with-' | tr '\n' ' ')
# $OpenBSD: ssh_config,v 1.33 2017/05/07 23:12:57 djm Exp $
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.
# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
@martin-juul
martin-juul / install_php
Created September 1, 2019 14:42
phpbrew helper
#!/usr/bin/env bash
PHP_VERSION=${1}
if [[ -z $PHP_VERSION ]]; then
echo "You must specify a php version. Eg: install-php 7.3"
exit 1
fi
echo "Installing PHP ${PHP_VERSION}"
@martin-juul
martin-juul / .zshrc
Last active September 1, 2019 17:35
#!/usr/bin/env zsh
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
fpath=(/usr/local/share/zsh-completions $fpath)
fi
export HOMEBREW_NO_ANALYTICS=1
export PATH="/usr/local/opt/bison/bin:$PATH"
@martin-juul
martin-juul / common.bash
Last active September 20, 2019 11:28
Common bash helpers These snippets are meant for large deployments, so if something is marked as *standard* - do not change those values Before you start I know it tempting to use csh, fish, zsh etc.. - but the fact of the matter is, if youre lu
#!/usr/bin/env bash
# Battle tested for macOs deploy scripts
# disable builtin echo so we can use '-en'
enable -n echo
# Get the real path to the location of the script
shopt -s nullglob
DIR=$(
# Read a single char from /dev/tty, prompting with "$*"
# Note: pressing enter will return a null string. Perhaps a version terminated with X and then remove it in caller?
# See https://unix.stackexchange.com/a/367880/143394 for dealing with multi-byte, etc.
get_keypress() {
local REPLY IFS=
printf >/dev/tty '%s' "$*"
[[ $ZSH_VERSION ]] && read -rk1 # Use -u0 to read from STDIN
# See https://unix.stackexchange.com/q/383197/143394 regarding '\n' -> ''
[[ $BASH_VERSION ]] && read </dev/tty -rn1
printf '%s' "$REPLY"
@martin-juul
martin-juul / AbstractProcess.php
Last active December 7, 2019 21:42
hls live transcoding
<?php
namespace App\Transcode\FFMpeg;
use Illuminate\Support\Arr;
use Symfony\Component\Process\Process;
abstract class AbstractProcess
{
abstract protected function getBinaryPath(): string;