Skip to content

Instantly share code, notes, and snippets.

View cwerner1's full-sized avatar

Christian Werner cwerner1

View GitHub Profile
@wizardishungry
wizardishungry / Gemfile
Last active February 12, 2018 18:49
Vagrant snippet to set VirtualBox guest CPU count to the number of host cores on Linux or OS X (broken 2018)
gem 'concurrent'
@joergschiller
joergschiller / a2dp_sink_ubuntu_linux.md
Created January 24, 2012 23:05
A2DP Sink on Ubuntu Linux with bluez (streaming bluetooth stereo audio from smartphone to pc)

Howto Enable and Use A2DP Sink on Ubuntu Linux with Bluez

  1. Add Enable=Source to /etc/bluetooth/audio.conf right after [General].

  2. Find address in form XX:XX:XX:XX:XX:XX of phone with hcitool scan.

  3. Pair and trust smartphone with sudo bluez-simple-agent hci0 XX:XX:XX:XX:XX:XX and sudo bluez-test-device trusted XX:XX:XX:XX:XX:XX yes.

  4. Create loopback in pulseaudio connection bluetooth a2dp source with alsa sink:

@chluehr
chluehr / toAscii.php
Created January 18, 2012 12:56
PHP clean url slug generator / converter (slug)
<?php
// source: http://cubiq.org/the-perfect-php-clean-url-generator
// author: Matteo Spinelli
// MIT License / http://creativecommons.org/licenses/by-sa/3.0/ (please re-check at source)
setlocale(LC_ALL, 'en_US.UTF8');
function toAscii($str, $replace=array(), $delimiter='-') {
if( !empty($replace) ) {
$str = str_replace((array)$replace, ' ', $str);
}
@mezis
mezis / git-merge-po.sh
Last active November 20, 2023 11:33
Git merge driver for PO files
#!/bin/sh
#
# *******************************************
# WARNING: this does *not* handle 3-way merges properly.
# Anything modified on the local branch since the common base will get ignored.
#
# FOR ANYONE LANDING HERE:
# This script is now updated as part of the git-whistles gem.
# https://github.com/mezis/git-whistles
# *******************************************
@RichardBronosky
RichardBronosky / backfill.sh
Created November 19, 2011 06:28
setup and use logstash
# A few oneliners to backfill the logstash with logs from all the apache servers
# (there server is running in a screen session in my home directory on "django apache admin 1" aka: djaapaadm1)
# Try searching for error at http://djaapaadm1.ddtc.cmgdigital.com:9292/
# backfill access logs to the listen on port 9293
for n in {1..10}; do ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no djaapaprd$n.ddtc.cmgdigital.com 'tail -n 10000 /localfs/httpd/logs/*-access_log' | sed '/^$/d;/^==> /d'; done | pv | nc djaapaadm1.ddtc.cmgdigital.com 9293
# backfill error logs to the listen on port 9294
for n in {1..10}; do ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no djaapaprd$n.ddtc.cmgdigital.com 'tail -n 10000 /localfs/httpd/logs/*-error_log' | sed '/^$/d;/^==> /d'; done | pv | nc djaapaadm1.ddtc.cmgdigital.com 9294