Skip to content
accelerando

Tag Archives: Tipps

Git snippets

22-Dec-11

These are a view things that i had looked up to solve some problems and i plan to update this post regularly…

To push a new branch to remote

git push origin new_branch

To delete a remote branch

git push origin :new_branch

To push new tags

git push --tags origin

To delete a remote tag

git tag -d 12345
git push origin :refs/tags/12345

To reset a local branch to exactly match a remote branch

git fetch origin
git reset --hard origin/master

To abort a rebase

git rebase --abort

Changing the origin of your git repository (relocate the repository)

git config remote.origin.url [new origin url]

Last update: 2012/01/04

Create reusable MySQL schema dumps

16-Sep-10

In case you need a MySQL schema transferred from one host to another and the schema names differ, you can ran into problems with a standard MySQL dump.

Use the following statement to create a schema dump that contains all table and view definitions as well as all stored procedures without a reference to the original schema:

 mysqldump -uroot -p name_of_the_original_schema --no-data --opt --routines | sed 's/`name_of_the_original_schema`.//g' > dump.sql

The dump will only contain the schema definition and no data. Calls to routines will not be prefixed with a schema name.

iTunes terminal tipps 2010

13-Sep-10

4 years ago i had a first iTunes terminal tipp, here is a round up (all terminal tipps require Mac OS X):

Invert the iTunes Store links in the list

The littler arrows can either point to the iTunes store or to the same artist or album in your library. Invert their behavior to let them point to your files instead of the store:

defaults write com.apple.iTunes invertStoreLinks -bool YES

Undo this with

defaults write com.apple.iTunes invertStoreLinks -bool NO

Disable them with

defaults write com.apple.iTunes show-store-arrow-links -boolean FALSE

Enable them with

defaults write com.apple.iTunes show-store-arrow-links -boolean TRUE

Restore the horizontal stoplight

Again, Apple messes with it’s own UI guidelines. To restore sanity, use

defaults write com.apple.iTunes full-window -boolean TRUE

Reenable the vertical layout introduced with iTunes 10 through

defaults write com.apple.iTunes full-window -boolean FALSE

Enable half-star ratings

The following will let you rate your songs with half-star ratings (i.e 3.5 stars):

defaults write com.apple.iTunes allow-half-stars -bool TRUE

If you don’t like the fact, that the half-star ratings will round on any i* device, turn it off again:

defaults write com.apple.iTunes allow-half-stars -bool FALSE

Linux: Persistent wake-on-lan

03-Mar-10

Just a quick reminder for myself: You need to enable wake-on-lan on the nic in most linux distributions via ethtool.

If your nic supports WOL, it probably needs to be enabled in your computers BIOS first.

Most WOL tools use the “MagicPacket(tm)” method, so the right command to enable it on the nic “eth0″ would be

ethtool -s eth0 wol g

This is not a persistent setting and it is gone after a reboot. Most tips around recommend creating a runlevel script for executing this command after boot or before shutdown.

I’ve added the command as a hook in my network scripts:

auto eth0
iface eth0 inet dhcp
        pre-down ethtool -s eth0 wol g

You can also use post-up. I like this method because i tend to forget about my runlevel scripts and so i keep the network stuff in one place ;)

If you are a debian user, you maybe need to stop your system from turning off the nic on HALT. To do so, add

NETDOWN=no

to “/etc/default/halt”.

How to change the image assets path in Rails

01-Nov-09

I found no other way to change the path of “images” in a Rails application than monkey patching the AssetTagHelper like so:

module ActionView
  module Helpers #:nodoc:
    module AssetTagHelper
      def image_path(source)
        compute_public_path(source, 'static_images')
      end
      alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route
    end
  end
end
Close
E-mail It