As root, execute one of these depending on the desired action:
echo -n mem > /sys/power/state # suspend to ram echo -n disk > /sys/power/state # suspend to disk
Credits / Source: TipsForLinux’s post.
As root, execute one of these depending on the desired action:
echo -n mem > /sys/power/state # suspend to ram echo -n disk > /sys/power/state # suspend to disk
Credits / Source: TipsForLinux’s post.
This post is intended for you fellow users of Xfce, a window manager and suite of applications.
The Thunar file browser is a very interesting of these applications:
The one awesome feature we discuss here is about incrementing your configuration with custom actions for files and directories that are made accessible via their context menu.
Now for the 3rd field, “Command” here is the very nice and handy part:
Insert a command of yours to do something. In my case, I want to rename files so that they do not have special characters. I will do this by invoking the xfce4-terminal (obviously, also from the Xfce suite of applications) which in turn invokes bash with its -c option (which receives an argument string comprised of commands to be evaluated i.e. executed).
Here ‘s the code:
xfce4-terminal -x bash -c '/path_to_script/renameok.sh %f'
The script renameok.sh iterates through directories renaming their files stripping special characters. Soon a post will be included containing its source code and explanation.
If your script (generally referred to as script.sh instead of the specific renameok.sh) depends on stuff setup in .bashrc (the shell resource file) then just call bash with -i (bash -ic “command(s)”) which sets the interactive mode on and calls the resource file before executing the -c option commands. Also realize that when in an interactive session, if script.sh is in a PATH setup by .bashrc you are safe to remove the /path_to_script/ part of script.sh ‘s call as it will be thus found. And last, as my .bashrc can have some echo commands in it, I will deliberately add a clear command before the script call so that the resulting code will look like:
xfce4-terminal -x bash -ic 'clear; renameok.sh %f'
Now, in the Appearance Conditions tab uncheck every options but Directories as in this example we use the directory in which the context menu was invoked as the script ‘s argument (as it wants a directory path). This indeed causes the action to be available only for directories’ context menus in Thunar. The main purpose in this tab is for you to choose which type(s) of files (directories are a type of file) you want the action to be executable.
In the custom action entry edition dialog, still, notice the bottom of the window, which explains the meanings of the expansions including the %f shown in the examples herein. One interesting and awesome thing is that Thunar is also smart enough to realize that the actions must not be made available if more than one file (or directory, as in these examples) are selected in case you are using %f. Conversely, the action is selectable both for just one file or for multiple files when using %F instead.
To know more check the official wiki entry.
Enjoy! ;)
Append /etc/modprobe.d/blacklist.conf with the line that follows:
blacklist pcspkr
The following script finds git repositories under your current working directory (represented by ‘.’ i.e. a dot):
gitpulls() { echo "$(find . -name '.git' | sort)" | while read i; do cd "$(dirname ${i})" echo ">>>> pulling $(dirname ${i#./}) ... <<<<" git pull echo '' cd - > /dev/null; done unset i }
After defining it (possible in your .profile, .bashrc, .kshrc etc.), navigate to the desired (a common ancestor to your git repositories) directory and call it:
gitpulls
So, it would be nice if you had a script to create an e.g. this.m3u playlist in each subdirectory of your music tree, right? Well, the script is here.
The following script generates a “this.m3u” file in each directory inside the directory tree rooted at the current working directory:
1 2 3 4 5 6 7 8 9 10 11 12 13 | #!/usr/bin/env bash find . -type d | while read d ; do echo "Generating m3u for directory '${d}'" echo '#EXTM3U' > "${d}/this.m3u" ls -1 "${d}" \ | egrep -i '[.]mp3|[.]flac|[.]wma|[.]ogg|[.]flv|[.]mp4' \ | while read f ; do echo "#EXTINF:0,${f%.*}" >> "${d}/this.m3u" echo "${f}" >> "${d}/this.m3u" done done |
So, to use it just cd to a directory and call it (suppose we called it ‘m3uzer.sh’ and its parent directory is already in the PATH environment variable):
cd some_musics_dir
m3uzer.shPretty handy, eh?
If you want to include extensions, just alter line 8 on the script’s source code.
If you changed your organization, just re-execute it on the root directory again and the whole tree will be updated.