Skip to content

Instantly share code, notes, and snippets.

@frace
frace / kms_no_monitor_config.txt
Last active February 15, 2017 13:35
Correct resolution in Xorg with Intel KMS and monitor enabled or disabled while booting the system
Instructions below - meant for versions prior to x11-base/xorg-drivers-1.19 - will work unless one hits this bug:
+ https://bugs.freedesktop.org/show_bug.cgi?id=92792
Additional three steps to success. The focus lies on "booting with monitor turned on or off".
Therefore I assume KMS works as expected and edid.bin exists inside /lib/firmware/edid.
Adjust your output connector and resolutions in all configs accordingly:
1. Kernel config (tested with 4.9.9)
+ CONFIG_FIRMWARE_IN_KERNEL=y
+ CONFIG_EXTRA_FIRMWARE="edid/edid.bin"
@frace
frace / orphaned_ebuilds
Last active May 11, 2016 17:10
Find orphaned entries in /etc/portage/package.use/*
while IFS=" " read -ra packages; do emerge -pq "${packages[0]}"; done < /etc/portage/package.use/world
@frace
frace / gitconfig
Created July 21, 2015 10:37
A Git alias to switch users: git su name email
[alias]
su = "!switchuser() { git config user.name $1 && git config user.email $2; }; switchuser"
@frace
frace / homebrew_read_access.markdown
Last active August 29, 2015 14:25
Homebrew setup guide for multiuser read acccess on Mac OS X

Prerequisites

Add admin user for Homebrew management and a standard user for daily work.

Installation

As admin user: 0. umask 002

  1. sudo mkdir /usr/local
  2. sudo chown root:admin /usr/local
  3. Install Homebrew in /usr/local
@frace
frace / 0_reuse_code.js
Last active August 29, 2015 14:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@frace
frace / ffmpeg commands
Last active September 11, 2021 08:36
A scrapbook for a script
# Get raw encoder value
ffprobe -v quiet -print_format compact=print_section=0:nokey=1:escape=csv -show_entries format_tags=encoder "$input_file"
# Get raw duration value
ffprobe -v quiet -print_format compact=print_section=0:nokey=1:escape=csv -show_entries format=duration "$input_file"
# Generate spectrogram
ffmpeg -ss "$start_position" -t "$duration" -i "$input_file" -f sox - | sox -t sox - -n spectrogram -o "${output_name}.png"
# Generate raw data used in spectrogram
@frace
frace / busybox_uninstall_applets
Last active August 29, 2015 13:56
Accidentally executed `busybox --install` on a Gentoo box?
#!/usr/bin/env bash
paths=(
"/bin"
"/sbin"
)
backup="/root/bbbackup"
if [[ ! -d "$backup" ]]; then
@frace
frace / 10-set-ssd-ioscheduler.start
Last active August 29, 2015 13:56
A "collection" of approaches to set the io scheduler for ssds on systems where both ssds and hdds are used.
# An openrc init script (local.d) which sets the io scheduler in "/sys/block/sd?/queue/scheduler"
# for a custom list of known solid state drives.
enable=false
local_start()
{
local ssd_scheduler
local -a ssd_devices
@frace
frace / leVader.js
Created May 28, 2013 13:34
A chainable jquery function to fade in a number of elements one after another.
/**
* A chainable function to fade in a number of elements one
* after another.
*
* @param {Object} timing
*
*/
$.fn.leVader = function( timing ) {
this.each(function( index ) {
$( this ).delay( index * timing.delay ).fadeIn( timing.duration );
@frace
frace / update-meta-dam
Last active December 16, 2015 19:49
Since DAM in TYPO3 does not allow batch processing of meta data for non-default languages we HAVE to do it on our own
UPDATE `tx_dam`
SET
`title`='title',
`loc_country`='country',
`loc_city`='city',
`description`='description',
`alt_text`='alt_text',
`caption`='caption',
`abstract`='abstract'
WHERE `sys_language_uid`=1 (AND `file_mime_type`='image')