Tuesday, October 15, 2013

Chatting on irc, relize something to add..

Always look at the date of the DATE of the blog posts..

;)


Monday, October 8, 2012

Scanned in jpg's converted to one pdf file.

Simple method for taking a bunch of scanned in jpeg files and making one paged pdf file.

for i in $(ls ~/Directory/*.jpg); do convert -verbose $i $(basename ${i%.jpg}).pdf ; done;

The above converts all jpegs into individual pdf pages.  Convert will connect them together for you, but unless you have a huge amount of memory it will fail.

pdftk *.pdf cat output newdoc.pdf

The above here combines all of the pdf pages into one document.  Instead of using wildcard you could take the time to arrange the pages as you see fit.

Thursday, September 20, 2012

Python!  Well its an easy language to learn.  I want to master it, so I'm making myself commit to at least three random that may or may not be useful, python tools a week.  This to keep my python skill sharp, and I will post my discoveries here.

The script grabs a url of unconditional file type to a file.

#!/usr/bin/python
# grabs a url to a file.

import sys
import urllib2
from os.path import basename
from urlparse import urlsplit

if len(sys.argv) < 2:
  print "Usage: %s <URL>" % sys.argv[0]
  sys.exit()

url = sys.argv[1]
urlContent = urllib2.urlopen(url).read()
fileName = basename(urlsplit(url)[2])
print "filename is: %s" % fileName
output = open(fileName,'wb')
output.write(urlContent)
output.close()

Trying to keep it simple as possible with minimal error checking.  You can add your own if you use the code. 

Saturday, May 1, 2010

Completed School! \o/

I'm finished! Done! Completed! Has been a long haul since Fall of 2006, great experiences, lots of work. Now I'm in a state of bliss. I think I will get back into this blogging again, maybe refine some ideas that I've had rolling around in my head. One of which is a Ruby on Rails web app, might have to do some preliminary websites for the feel of Rails.

Ruby is such a smooth language. Wrote a script to grab SNL (Saturday Night Live) every week so I can watch it on the ASUS O!play 99 dollar media player. That took about 4 hours total, and has been working pretty good for the past two months. Here's the script:
#!/usr/bin/ruby

require 'rss/2.0'
require 'date'
require 'open-uri'

unless ARGV.length == 2
puts "Usage: SCRIPT <daysback> <showname>"
exit
end

#rss is the rss url setup for bt-chat
#Should be set at eztv feed for shows
rss = 'http://rss.bt-chat.com/?group=3&cat=9'
day = ARGV[0]
srh = ARGV[1]

puts "day: #{day}"
puts "srh: #{srh}"

#This could be better..
Dir.chdir("/home/storage/watch")

feed = RSS::Parser.parse(open(rss).read, false)
puts "RSS Channel: #{feed.channel.title}"
now = DateTime.now

feed.items.each do |item|
if item.title.to_s =~ /#{srh}/
pub = Date.parse(item.pubDate.to_s)
difference = (now-pub).to_i
if difference <= day.to_i
unless File.file?(item.title.to_s)
puts "downloading: #{item.title}"
writeOut = open(item.title.to_s,"w")
writeOut.write(open(item.link.to_s).read)
writeOut.close
end
end
end
end
puts 'done..'

During the post of this code I relized a couple of things. I don't see a way to use web interface editor to post formatted source code. I used the unix GNU source-highlight to convert to html, with the --src-lang arg. Then piping output to xlcip putting the html into the clip board.

The editor would not take a middle click paste, maybe it will take a right-click paste. At the time did not know that so went through OpenOffice to get it on here. Next think I'll try and post it in a table box.

Tuesday, September 22, 2009

iMac networking (or gentoo DNS)

It is not 1:08 AM.   The file sharing is working, let me say something first here.  Basically the only thing I am learning is to read the logs period, as well as read the read documentation for whatever it is I'm trying to do, thinking of 'cups' now.

I have spent minutes, hours, days with cups and samba, I'm not sure which is more.  I just now started to read the cups log, and I see what is happening now.  I'm not going to fix it tonight, I'm just baffled at myself for, still trying not to do things the right way.  So cups is yet to be fully functioning how I would like.  YET!

On the positive side the file sharing is working, and that had to do with the DNS.  The dnsmasq, and also more the dhcpcd is misconfigured.  I got around that via adding the ISP's DNS servers to the local machine for now.  Which is okay, this network is not that big.  Here's a screen shot, just because screen shots are cool :)  


Man my back hurts a little bit, time for a better chair situation soon :)  Peace have a nice night, and remember to READ, DUH, didn't you learn that somewhere? :)

Saturday, September 12, 2009

Setting up an apartment routing cabinet

I've been working on setting up a routing cabinet. I'm not buying anything new so if I don't have something, I have to be a little creative. Its in the kitchen, inside the wood cabinets that you usually would put dishes, pots and pans. I had to drill a 1-1/4" hole in the bottom to run a power cable that leads to a power outlet strip, and also I can run a couple of ethernet cables through there as well.

I do not have a layer2 switch at the moment so I had to learn again the color codes for ethernet cross over cables. It took me 2 extra ends but it was kinda fun after I got into it. I'll have to make more later.

This things got a long way to go, but the router which is a breadbox linux router/wirelessAP/samba/printer/scanner server, has been running over at a friend of mines house for about 3 weeks. They started to depend on the file server, and sometimes used it for printing. The scanner is running local mode, and I need to test it in network mode from this Mac.

Here's a picture, Its messy, because the cabling is not fully finished. The can with no label is a Cantenna that should be able 12dbi range that I made a little while back. That might be used to pick up a backup wireless :) But the main internet uses Clearwire, which is a WiMAX protocol, city wide wifi.


Howto Ethernet Cable - Crossover

Here is a chart that I took from Wikipedia, about the color codes to an Ethernet crossover cable. Some other tips are: After you have unwrapped and set the wires up in your hand, that you cut the top as close to 1/2" as possible. Also kind of "let" the wires untwist themselves, naturally allowing them to fall into place.

I haven't made a crossover cable in quite a while so this is a way for myself to remember the exact color codes.