This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This gist is related to C Evan's comment on | |
# http://zipizap.wordpress.com/2012/10/15/xkl-ubuntu-install-resizing-ntfs-partition-takes-too-long-check-ntfsresize-from-console-with-strace/ | |
# | |
# Hi Evans :) | |
# | |
# I see what you mean: only strace the writes to stdout, and not all writes that | |
# also contain moved data of the resize... And it got me interested in better understanding | |
# the strace options, so I did a little "man strace" study and then a little program in C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
red@ownc:/tmp$ cat a.sh | |
#!/bin/bash | |
# Activate debug | |
set -x | |
echo "hi" | |
ls | |
pwd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
du -k . | egrep -v '\/.*\/' | sort -n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[[ -r $1 ]] || { echo "Usage: $0 <videofile-to-be-resized> [<videofile2> ...]"; exit 1; } | |
for INPUT_FILE in $@; do | |
OUTPUT_MP4_FILE=$(echo $INPUT_FILE | sed 's/\.[^.]*$/.mp4/g') | |
#See https://trac.ffmpeg.org/wiki/x264EncodingGuide | |
avconv -y -i $INPUT_FILE -threads auto -c:v libx264 -preset medium -b:v 988k -pass 1 -an -f mp4 /dev/null && \ | |
avconv -i $INPUT_FILE -threads auto -c:v libx264 -preset medium -b:v 988k -pass 2 -c:a libmp3lame -b:a 192k $OUTPUT_MP4_FILE | |
rm -f av2pass* &>/dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function shw_grey { echo -e '\033[1;30m'"$1"'\033[0m'; } | |
function shw_norm { echo "$1"; } | |
function shw_info { echo -e '\033[1;34m'"$1"'\033[0m'; } | |
function shw_warn { echo -e '\033[1;33m'"$1"'\033[0m'; } | |
function shw_err { echo -e '\033[1;31mERROR: '"$1"'\033[0m'; } | |
shw_info "Check starting..." | |
find . -type f -exec wc -l \{\} 2>&1 \; | grep error | |
shw_info "Check finished" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you put this check inside ~/.bashrc you can detect bash session opened by ssh-logins :) | |
[ "$SSH_CONNECTION" -a "$SSH_TTY" == $(tty) ] && echo "This bash session was opened from an ssh login :)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function shw_grey { echo -e '\033[1;30m'"$1"'\033[0m'; } | |
function shw_norm { echo "$1"; } | |
function shw_info { echo -e '\033[1;34m'"$1"'\033[0m'; } | |
function shw_warn { echo -e '\033[1;33m'"$1"'\033[0m'; } | |
function shw_err { echo -e '\033[1;31mERROR: '"$1"'\033[0m'; } | |
function shw_usage { | |
cat <<EOT | |
Resize all JPEG files in current directory, to <GEOMETRY> size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Download the script OpenDns_setup_dhclient.conf.sh | |
wget "http://gist.github.com/raw/565137/0ac98870256cbdb53eb8c16ccb69008a95c20127/OpenDns_setup_dhclient.conf.sh" | |
#Run it once as root | |
sudo bash OpenDns_setup_dhclient.conf.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#download the script into the Dropbox folder | |
cd $HOME/Dropbox && wget "http://gist.github.com/raw/564419/35634bc7a13e22dd58b5b0db645c2620b5aedc20/bckpDir2home.sh" | |
#and run it whenever you want to make a new backup. | |
cd $HOME/Dropbox | |
bash bckpDir2home.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "\e[1;30msome color text\e[0m" |