Skip to content

Instantly share code, notes, and snippets.

View flyingoctopus's full-sized avatar

Vincent van Haaff flyingoctopus

  • flyingoctopus
  • Vancouver, BC
View GitHub Profile
@the-spyke
the-spyke / pipewire.md
Last active May 3, 2024 13:19
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.

@pgib
pgib / delete-branch.sh
Created April 17, 2012 16:13
Delete multiple local/remote git branches. (Put this in your shell's profile and smoke it!)
delete-branch()
{
for i in `echo $*`; do
echo "Deleting local and remote branch $i..."
git push origin :$i
git branch -D $i
done
}
@pgib
pgib / outside_temp.rb
Created November 10, 2011 23:58
Get me some temperatures for screen's backtick!
#!/usr/bin/env ruby
# encoding: UTF-8
require 'rubygems'
# https://github.com/jnunemaker/google-weather/
# gem install google-weather
require 'google_weather'
# usage: outside_temp.rb [City,Province|Postal Code]
if ARGV.size == 0
@pgib
pgib / archive_github_repo.sh
Created October 17, 2011 22:48
Put this in your shell's respective dot profile and smoke it!
archive_github_repo()
{
if [ ! -d .git ]; then
echo "You must run this from within the root of your git repo."
exit 1
fi
pwd=`pwd`
repo_url=`git config --local --get remote.origin.url`
repo_name=`echo $repo_url | awk -F / '{print $2}' | sed -e s/.git//`
@jcasimir
jcasimir / render_and_redirect.markdown
Created September 11, 2011 21:29
Render and Redirect in Rails 3

Render and Redirect

The normal controller/view flow is to display a view template corresponding to the current controller action, but sometimes we want to change that. We use render in a controller when we want to respond within the current request, and redirect_to when we want to spawn a new request.

Render

The render method is very overloaded in Rails. Most developers encounter it within the view template, using render :partial => 'form' or render @post.comments, but here we'll focus on usage within the controller.

:action

@mnmly
mnmly / coffee-stained-paper.js
Created August 23, 2011 05:57 — forked from j4mie/example.html
A tiny shim for Paper.js/CoffeeScript prototyping
window.stainedPaper = function (func) {
var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
paper.setup(canvas);
func.call(paper);
};
@gyulalaszlo
gyulalaszlo / install_rails_stack.sh
Created August 10, 2011 02:58
Debian from blank install to RVM + Ruby 1.9.2 + MongoDB 1.8.2 + NGINX + Passenger + Node + Coffee
#!/usr/bin/env bash
echo '=========================== '
echo 'This script will attempt to install on a blank Debian Lenny / Squeeze: '
echo ' '
echo 'RVM with Ruby 1.9.2 '
echo 'NodeJS v0.4.10 with NPM and Coffee-Script '
echo 'MongoDb for the DB '
echo 'Imagemagick for the MiniMagick gem '
echo 'Passanger with nginx '
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around wordpress issues - Patrick Anderson (patrick@trinity-ai.com)
# clearly this could be cleaner, but it does work
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
# patch Php from rack-legacy to substitute the original request so
# WP's redirect_canonical doesn't do an infinite redirect of /
@jpantuso
jpantuso / osx_lion_rail_setup.md
Created July 27, 2011 19:51
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL