Skip to content
accelerando

Category Archives: Shortcuts

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

Scripted network mounts with Windows

12-Dec-11

I have some services and scheduled tasks that call a Batch file under windows. The scheduled tasks cannot access network drives that the assigned user has defined, but luckily there is a “mount” pendant within Windows as well.

To mount a network share within the Batch script use:

net use t: \\server\share /persistent:no

The authentication is taken from the user that is assigned to the task.

If this not enough use

net use t: \\server\share /persistent:no /user:user@domain password

To unmount the share use

net use t: /delete

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.

Find all non “.java” files but not in .svn directories

19-Aug-10

I’m migrating some old projects to Maven and i need to move all resources out of the source tree.

find . -type d -name '\.svn' -prune -o -type f -not -iname "*.java" -print
  • Prune every directory named ‘.svn’
  • Or
  • Type is file and the name ends not with “*.java”

I tried to create the necessary directories within the same command but after about half an hour xargs trial and error, i’ll do it manually, the list of files is small enough ;)

Oracle NLS-Lang Settings

13-Aug-10

To use SQL*Plus Windows correctly, export NLS_LANG like so:

set NLS_LANG=GERMAN_GERMANY.WE8MSWIN1252

If you prefer the command line client SQL*Plus, export NLS_LANG like so:

set NLS_LANG=GERMAN_GERMANY.WE8PC850
Close
E-mail It