Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - GrouchyGaijin

Pages: [1] 2
1
Scripts / Version 3.1
« on: April 19, 2013, 08:45:15 AM »
Took care of some repetitive tasks via functions.
Code: [Select]
#!/bin/bash
echo "Unload_camera version 3.1: This script will remove images and videos from your camera."
echo "Basic script by GrouchyGaijin. Heavy lifting by schragge. Additional modifications by cortman, steeldriver, and ofnuts"
echo "Run this script from the camera" 
now=$(date +"%d-%b-%Y-%T")
mkdir /path/to/where/you want/the/pictures/put/$now
echo "Making directory to hold the photos."

dir="/path/to/clips/directory"
read -p "Press Enter to check if the clips directory is empty"
if [ "$(ls -A $dir)" ]; then
     echo "Clips is not empty. Did you forget to empty it last time?"
fi
echo "If files were found type yes to empty the directory"
read x
if [ "$x" = "yes" ]
then
rm -f "$dir"/*
else
echo "OK, Leaving the directory as is."
fi
                 
pics_dir="/path/to/$now"
clips_dir="/path/to/clips"

process_image() {
  echo Resizing "$1"
  gm mogrify -resize 720x720 "$1"
  echo Moving "$1" to $pics_dir
  mv "$1" "$pics_dir"
}
process_video() {
  echo Moving "$1" to $clips_dir
  mv "$1" "$clips_dir"
}

process_thumbnail() {
  echo Removing "$1" from the camera
  rm "$1"
}

unload() {
  case $1 in
    image) pattern='*.jpg *.JPG *.png *.PNG *.GIF *.gif';;
    video) pattern='*.MOV *.mov *.mpg *.MPG *.mpeg *.mp4';;
    thumbnail) pattern='*.THM';;
    *) echo Unknown file type, aborting...; exit 1;;
  esac
  echo Press Enter to search for $1 files; read start

  unset found
  for i in $pattern; do
    if [[ -f $i ]]; then
      [[ -v found ]] || echo ${1^}s found.
      : ${found:-set}
      process_$1 "$i"
    else
      echo Skipping $i: not a regular file
    fi
  done
  [[ -v found ]] || echo No or no additional ${1}s found.
}
shopt -s nullglob
unload image
unload video
unload thumbnail

2
Scripts / Re: man pages to pdf
« on: April 17, 2013, 02:13:09 PM »
I know - but you posted it. John wrote a great script.

3
Scripts / Re: man pages to pdf
« on: April 17, 2013, 12:19:33 PM »
Very cool indeed S11 8)

4
Scripts / I got tired of pulling tons of photos off my wife's camera
« on: April 17, 2013, 12:12:38 PM »
See below for version 3 of the script.
The heavy lifting was done by schragge at the Ubuntu Forum's Programming sub-forum.

So - I wrote a VERY simple script to pull everything off.
It puts the images in a folder labeled with the date.
It resizes the images for posting on my website.
(I live in Sweden, but am from the US, my wife is from Japan - so we have a website devoted to our kids.  Both sets of Grandparents love it.)
It puts the videos in a folder I use to store clips until I can edit them.
It removes all the thumbnail (.THM) files from the camera.

Anyway,  here it is:

Code: [Select]
### Unload_camera ###
### By Grouchy Gaijin ###
### Tweaked by Sector_11 ###
### This is really simple.  You only need to install GraphicsMagick to resize the images and then adjust
###the paths of the folders. ###
### Make the script executable chmod +x Unload_camera and call the script from the camera. ###


#!/bin/bash
echo "Are you SURE you are in the right folder??"
##### Because I am a dumbass and sometimes run this from the wrong folder. #####
echo "ALL files in the clips folder will be deleted."
#### Because I always forget to delete them after I post a video #####
read -p "If so, press the [Enter] key continue..."

# now is the folder where the script will put your photos #
# I have the date set in the format of 15-Apr-2013 #
now=$(date +"%d-%b-%Y")

# gm mogrify is the GraphicsMagick command to resize all jpeg files in the source direcory #

gm mogrify -resize 720x720 *.jpg *.JPG

# change the path of mkdir to where ever you want the new direcory to be #
mkdir ~/path/to/$now &&
mv *.JPG ~/path/to/$now
mv *.jpg ~/path/to/$now

# The script will pull any videos off your camera and put them in the assigned direcory #
# My direcory is called clips.  Before moving new videos into the clips direcory, the script will delete # # anything it finds there. #

rm -f /path/to/the/direcory/where/you/store/all/of/your/clips/before/editing/*

# The script also removes any video thumbnail files from the camera #
# I added .MOV and .mov in case you pull from a drive with Mac files on it (iPhone, cough cough) #
rm *.THM
mv *.MPG /path/to/destination/folder/
mv *.MOV /path/to/destination/folder/
mv *.mov /path/to/destination/folder/

5
General Support / Re: Long urls in mutt
« on: March 30, 2013, 07:01:57 PM »
Well there is a program in the repository called urlscan which is meant as a replacement to urlview.
Urlscan seems to work with long urls.  It is weird though, I hit Ctrl+B and up comes a list of urls in the message.
If I highlight one and hit enter, I get an error message:
Code: [Select]
< [17799:17824:0330/195717:ERROR:object_proxy.cc(624)] Failed to get name owner. Got org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'org.chromium.Mtpd': no such name
                             [17799:17824:0330/195717:ERROR:object_proxy.cc(624)] Failed to get name owner. Got org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'org.chromium.Mtpd': no such name
                                                        [17799:17799:0330/195718:ERROR:object_proxy.cc(529)] Failed to call method: org.chromium.Mtpd.EnumerateStorages: object_path= /org/chromium/Mtpd: org.freedesktop.DBus.Error.ServiceUnknown: The name org.chromium.Mtpd was not provided by any .service files
but then the browser opens up and takes me to the link.

6
General Support / Re: Long urls in mutt
« on: March 30, 2013, 06:44:47 PM »
Thanks - still chokes on the long urls.   :'(

7
General Support / Re: Long urls in mutt
« on: March 30, 2013, 02:52:53 PM »
It looks like urlview will do the trick.
Hitting ctrl+B brings up a list of urls in a message that I can click on

I'll know if it really works the next time I get a long url.

8
General Support / Re: Long urls in mutt
« on: March 30, 2013, 02:09:34 PM »
@Sector_11 My bad - ICEWEASEL

On a serious note, I don't follow how tiny url would work for incoming mail.  I see that you can make a long url into a short one and then send it in email, post to Twitter etc.  What I need though is to be able to click links that are in mail other people send to me.

9
General Support / Long urls in mutt
« on: March 30, 2013, 12:29:19 PM »
Hi Guys,

I figured that since Mutt is included in VSIDO someone might have an answer about a problem I've noticed with Mutt.
I am using Mutt-patched from the Ubuntu repository (Yes, I am one of the unwashed.)
Anyway, it works really well except that if a url extends to multiple lines, Mutt can't figure it out and clicking leads to a page not found error.

I tried copying the url, but when I highlight the lines with the url I end up copying a bunch of other stuff that is not in the url (like part of the list of folders in the Mutt side panel, for example).

Does anyone know a way to deal with long urls aside from opening up Thunderbird?

Thanks for any advice, I really appreciate it.

10
How To's / Re: Multi lingual spell checking in mutt
« on: February 05, 2013, 10:16:03 PM »
Hey, nice stuff GG.  I'll have to try that with English - Spanish

Thanks for this.

If you'd like to continue this email in English, press 1... :D

11
How To's / Multi lingual spell checking in mutt
« on: February 05, 2013, 09:44:44 PM »
I started using mutt a few days ago and found that I missed the ability of spell checking in both Swedish and English.
There are several ways to solve this problem, so you might know one that is better / easier than the solution I use.

1. You could just set an editor like abiword to be the mail editor in mutt.  In the .muttrc file add
Code: [Select]
set editor="abiword"I didn't want to do this, because after all, mutt runs in the terminal and using abiword (or whatever gui text editor) seems to violate the spirit of the thing.  ;)

2. You could use vim as the editor.  I had already managed to get vim to spell check Swedish and English, so that would be the obvious choice, right?  (Shhhh I don't like vim at all - I keep forgetting the key combinations to do things, not to mention to hit the escape key before I try to move to a misspelled word.)

3. I wanted to use nano.  Why, because it is easy and runs in the terminal.

The problem is that nano comes with a terrible spell check that only tells you which words it doesn't know.  If I knew how to spell them, would they be wrong?  Aspell on the other hand, offers useful suggestions.  I wanted to use Aspell.

The problem is that Aspell didn't like loading the en_US and sv_SE dictionaries together.  I tried making a custom dictionary and that worked OK, except not in mutt.  In mutt, I'd get a spell check abnormal failure.

Then I found this bash script that let's me choose which dictionary I want to load after I invoke the spell check command.

Code: [Select]
#!/bin/bash
read -p "Aspell: Select language: (US) SV" -s -n 1
case $REPLY in 
2|[Sv]) opts=( -l sv_SE.UTF-8 ) ;;
*) opts=( -l en_US.UTF-8 ) ;;
esac
exec aspell ${opts[@]} -e -c $1


Next I edited the nanorc file which on my system is at
Code: [Select]
/etc/nanorcI changed the set speller setting to point to the script
Code: [Select]
set speller "/path/to/the/script/alpine_aspell"
Now when I hit the spell check command in nano (which my mutt uses) I get a choice: Press 1 for English or 2 for Swedish - and I'm good to go.

This worked for me.  I hope you find it useful.

12
Introductions / Re: Hej from Sweden
« on: January 21, 2013, 01:09:36 PM »
Sure is.. Under Profile/Notifications there are options for

I have this set

Turn notification on when you post or reply to a topic.

I also have this set

When sending notification of a reply to a topic, send the post in the email (but please don't reply to these emails.)

and finally

For topics and boards I've requested notification on, notify me:

You have four options... I have mine set for Instant

You can also set notifications on at the Category level and at the Board level

Thanks -  I'm set  :)

13
Introductions / Re: Hej from Sweden
« on: January 21, 2013, 12:40:45 PM »

Meantime, coffee?

Of course - it's always coffee time!


14
Conky / Re: Conky Codes and Images
« on: January 20, 2013, 08:57:10 PM »

If you like you can go on over to the introductions thread and meet the community.


Done  :)

15
Introductions / Hej from Sweden
« on: January 20, 2013, 08:54:25 PM »
Hi Guys,

Sector_11 turned me onto this forum as the place to go for Conky talk.
I live in Sweden, but am not Swedish.  The name GrouchyGaijin comes from my personality - my wife and kids have been known to tell me that I'm being grouchy.  Gaijin (外人 if you read Kanji) basically means outsider or non-Japanese.  Since my wife is from Japan and I'm not - well then - I'm a gaijin.   :D

Pages: [1] 2