Skip to content

Instantly share code, notes, and snippets.

Markus Bukowski mrbuk

Block or report user

Report or block mrbuk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mrbuk
mrbuk / make-it-sound.sh
Created May 1, 2018
Set the default sink and source
View make-it-sound.sh
#!/bin/bash
DEFAULT_CARD=alsa_card.pci-0000_01_00.1
DEFAULT_SOURCE=alsa_input.usb-046d_HD_Pro_Webcam_C920_B6E53ECF-02.analog-stereo
SOUND_FILE=ChID-BLITS-EBU-Narration441-16b.wav
function stop_sound_system() {
echo "Stopping pulseaudion"; killall pulseaudio
echo "Waiting 10s ..."; sleep 10
@mrbuk
mrbuk / DisplayProductID-76e7
Last active Oct 8, 2017
LG31MU97 MacOS 50Hz patched EDID
View DisplayProductID-76e7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DisplayPixelDimensions</key>
<data>
AAAQAAAACHA=
</data>
<key>DisplayProductID</key>
<integer>30439</integer>
View set_hidpi.sh
#!/bin/bash
# if the notebook lid is closed the the display is identified as "DisplayPort-0". If the notebook lid is open it is identified as "DisplayPort-1"
# in case of a closed lid "DisplayPort-1 disconnected" can be found in xrandr output.
# default to notebook lid is open
TARGET_DISPLAY="DisplayPort-1"
xrandr | grep 'DisplayPort-1 disconnected' > /dev/null
if [ "$?" == 0 ]; then
@mrbuk
mrbuk / Dockerfile
Last active Jun 27, 2016
firehose-to-syslog build env
View Dockerfile
FROM centos:centos6
# install epel for new git version
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# golang dependencies: gcc for cgo
RUN yum -y update && yum -y install \
g++ \
gcc \
libc6-dev \
@mrbuk
mrbuk / check_if_skipped.py
Created Jun 22, 2016
Check log output for skipped lines
View check_if_skipped.py
# when checking cf logs invoke with
# awk '{print $4}' log-example.out | egrep '^[0-9]+' | sort -n | python script.py
#
import sys
def checkLineConsistency(previous, current):
if previous[0]+1 != current[0]:
print "Inconsistency between line %d ('%d') and %d ('%d')" % (previous[1], previous[0], current[1], current[0])
@mrbuk
mrbuk / refresh_pac.command
Last active May 29, 2016
Refresh PAC by disabling/enabling proxy state
View refresh_pac.command
#! /bin/sh
read -r -d '' script << _EOF_
networksetup -listallnetworkservices | awk 'NR>1' | while read SERVICE ; do
if networksetup -getautoproxyurl "\$SERVICE" | grep '^Enabled: Yes' >/dev/null; then
networksetup -setautoproxystate "\$SERVICE" off
networksetup -setautoproxystate "\$SERVICE" on
echo "\$SERVICE" bounced.
fi
done
@mrbuk
mrbuk / toggle_natural_scrolling.command
Created May 29, 2016
Toggle natural scrolling on OSX
View toggle_natural_scrolling.command
#!/bin/bash
osascript <<EOF
tell application "System Preferences"
set current pane to pane "com.apple.preference.trackpad"
end tell
tell application "System Events"
tell application process "System Preferences"
tell tab group 1 of window "Trackpad"
@mrbuk
mrbuk / four-clojure-problem-92-1.clj
Last active Nov 15, 2015
Solution for 4clojure problem 92
View four-clojure-problem-92-1.clj
;;
;; first not so idiomatic approach to the problem to convert roman numerals to decimal.
;;
(fn roman-to-dec [s]
(let [default-f (fn [last acc]
(+ acc))
prefixed-f (fn [prefixes]
(fn [last acc]
(if (some #(= % last) prefixes)
@mrbuk
mrbuk / README.md
Last active Apr 4, 2017
Sticky IP addresses with VMWare Fusion
View README.md

It is possible in VMWare Fusion to ensure that a VM will always be assigned the same IP address - this is more convenient than making the VM use static IP via config of the Linux box it uses. The simplest way to achieve this is as follows (all performed on the Mac host, not the Linux guests)

sudo vim /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf

At the bottom of the file, after the following line:-

####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######

Before changing the configuration file it is recommended to put the vmnet service into config mode so that the file is not overwritten by Fusion itself. To do so run

@mrbuk
mrbuk / ParseHeapDump.sh
Created May 20, 2015
MAT headless mode
View ParseHeapDump.sh
#!/bin/sh
#
# This script parses a heap dump.
#
# Usage: ParseHeapDump.sh <path/to/dump.hprof> [report]*
#
# The leak report has the id org.eclipse.mat.api:suspects
# The top component report has the id org.eclipse.mat.api:top_components
#
You can’t perform that action at this time.