Sunday, March 11, 2012

Fun with OpenWRT

I've been using OpenWRT for a while. When Backfire 10.03.1 final was released, I flashed it the next day.
My router is Buffalo's WZR-HP-G300NH, which is pretty powerful for it's price.

As I've been tinkering, I've run across some annoyances.


Sysctl Settings

First up: Something seems funky in conntrack. Running logread shows lots of entries like:

nf_conntrack: table full, dropping packet.

nf_conntrack: table full, dropping packet.

nf_conntrack: table full, dropping packet.


In my google searches to solve it, I came across some "P2P settings" that lowers the timeouts to keep the tables from filling as quickly. Pop the following in /etc/sysctl.conf:




net.netfilter.nf_conntrack_checksum=0
net.ipv4.netfilter.ip_conntrack_checksum=0
net.ipv4.netfilter.ip_conntrack_max=16384
net.ipv4.netfilter.ip_conntrack_generic_timeout=60
net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=1200
net.ipv4.netfilter.ip_conntrack_tcp_timeout_fin_wait=120
net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait=60
net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait=60
net.ipv4.netfilter.ip_conntrack_tcp_timeout_close=5
net.ipv4.netfilter.ip_conntrack_udp_timeout=10
net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=180
net.ipv4.netfilter.ip_conntrack_icmp_timeout=10


I've also stuffed a usb stick in the back and I've been trying to get Squid working on it to supplement my WiMAX connection.



Installing SQUID

Downloading/Installing SQUID

# opkg install squid
Installing squid (2.7.STABLE9-1) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/packages/squid_2.7.STABLE9-1_ar71xx.ipk.
Installing libopenssl (0.9.8p-1) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/packages/libopenssl_0.9.8p-1_ar71xx.ipk.
Installing zlib (1.2.3-5) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/packages/zlib_1.2.3-5_ar71xx.ipk.
Installing libpthread (0.9.30.1-43.10) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/packages/libpthread_0.9.30.1-43.10_ar71xx.ipk.
Installing librt (0.9.30.1-43.10) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/packages/librt_0.9.30.1-43.10_ar71xx.ipk.
Configuring librt.
Configuring libpthread.
Configuring zlib.
Configuring libopenssl.
Configuring squid.

Directories

I had to create the following directories:
# mkdir -p /mnt/usbstorage/squid/squid-cache
# mkdir -p /mnt/usbstorage/squid/log

SQUID config file

My /etc/squid/squid.conf looks like:
pid_filename /var/run/squid.pid

cache_effective_user root
cache_effective_group nogroup
cache_mgr kamilion@gmail.com
visible_hostname fusion

# These default to lru if commented. Broken on '2.6'? (squid 2.6? Kernel 2.6?)
#cache_replacement_policy heap LFUDA
#memory_replacement_policy LFUDA

ipcache_size 2048
cache_swap_low 90
cache_swap_high 95
maximum_object_size_in_memory 100 KB

# If you have 64/8MB Router you can use 16MB cache_mem. If smaller, use 8MB ram. Any less, no worky well.
cache_mem 16 MB

# cache_dir: change it if you want. 100 meams 100MB cache size.
cache_dir ufs /mnt/usbstorage/squid/squid-cache 100 16 256

logfile_rotate 10
fqdncache_size 2048
memory_pools off
maximum_object_size 16384 KB
quick_abort_min 0 KB
quick_abort_max 0 KB
log_icp_queries off
client_db off
buffered_logs on
half_closed_clients off
negative_dns_ttl 10 second
connect_timeout 60 second
read_timeout 80 second
request_timeout 80 second

# Logs, goes to USB stick
cache_access_log /mnt/usbstorage/squid/log/squid-access.log
cache_log /mnt/usbstorage/squid/log/squid-debug.log
cache_store_log /mnt/usbstorage/squid/log/squid-storage.log

# Logs, goes into openwrt's existing log folder.
#cache_access_log /var/log/squid-access.log
#cache_log /var/log/squid-debug.log
#cache_store_log /var/log/squid-storage.log


hierarchy_stoplist on

# Our internal IP and listen port
http_port 10.30.60.254:3128 transparent

# Global ACL-Definitions (Access control lists)
acl idents ident REQUIRED
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl all src 0.0.0.0/0.0.0.0
acl intern dst 10.30.60.0/24
acl FTP proto FTP
always_direct allow FTP

# Allowed External Ports and Internal Lan IPs
acl Allowed_Ports port 80 99 443 21 563 488 777 210 1025-65535
acl yourLAN src 10.30.60.0/24

#http_access definition
http_access allow idents
http_access allow all
http_access allow intern
http_access deny manager all
http_access allow yourLAN
http_access deny all
icp_access deny all
miss_access allow all
always_direct allow intern

Check

Check if everything is ok
# squid -f /etc/squid/squid.conf -z

S80squid

This is the dd-wrt startup file I'm adapting. It starts SQUID and setting up the transparent iptables rules.
#!/bin/sh

INTERNAL_NETWORK=10.30.60.0/24
ROUTER_IP=10.30.60.254
PROXY_SERVER=10.30.60.254
PROXY_PORT=3128
# Uncomment this to short circuit setting iptables.
TRANSPARENT_PROXY="1"

case "$1" in
    start)
        echo -n "Starting proxy server: "
        /usr/sbin/squid -f /etc/squid/squid.conf
        if [ -z $TRANSPARENT_PROXY ]; then
            /usr/sbin/iptables -t nat -A PREROUTING -i br0 -s $INTERNAL_NETWORK -d $INTERNAL_NETWORK -p tcp --dport 80 -j ACCEPT
            /usr/sbin/iptables -t nat -A PREROUTING -i br0 -s ! $PROXY_SERVER -p tcp --dport 80 -j DNAT --to $PROXY_SERVER:$PROXY_PORT
            /usr/sbin/iptables -t nat -A POSTROUTING -o br0 -s $INTERNAL_NETWORK -p tcp -d $PROXY_SERVER -j SNAT --to $ROUTER_IP
            /usr/sbin/iptables -t filter -I FORWARD -s $INTERNAL_NETWORK -d $PROXY_SERVER -i br0 -o br0 -p tcp --dport $PROXY_PORT -j ACCEPT
            export TRANSPARENT_PROXY="1"
        else
            echo "This script has already run!"
            echo "If it hasn't, unset $TRANSPARENT_PROXY manually via the shell."
        fi
        echo "done."
        ;;
    stop)
        echo -n "Stopping proxy server: "
        /usr/sbin/squid -f /etc/squid/squid.conf -k shutdown

        if [ -z $TRANSPARENT_PROXY ]; then
            /usr/sbin/iptables -t nat -D PREROUTING -i br0 -s $INTERNAL_NETWORK -d $INTERNAL_NETWORK -p tcp --dport 80 -j ACCEPT
            /usr/sbin/iptables -t nat -D PREROUTING -i br0 -s ! $PROXY_SERVER -p tcp --dport 80 -j DNAT --to $PROXY_SERVER:$PROXY_PORT
            /usr/sbin/iptables -t nat -D POSTROUTING -o br0 -s $INTERNAL_NETWORK -p tcp -d $PROXY_SERVER -j SNAT --to $ROUTER_IP
            /usr/sbin/iptables -t filter -D FORWARD -s $INTERNAL_NETWORK -d $PROXY_SERVER -i br0 -o br0 -p tcp --dport $PROXY_PORT -j ACCEPT
            export TRANSPARENT_PROXY="1"

            /usr/sbin/iptables -t filter -L
            /usr/sbin/iptables -t nat -L
       else
           echo "This script has already run!"
           echo "If it hasn't, unset $TRANSPARENT_PROXY manually via the shell."
        fi

        echo "done."
        ;;
    reload|force-reload)
        echo -n "Reloading proxy server configuration files: "
        /usr/sbin/squid -f /etc/squid/squid.conf -k reconfigure
        echo "done."
        ;;
    restart)
        echo -n "Restarting proxy server: "
        echo "done."
        ;;
    *)
        echo "Usage: /etc/init.d/S80squid {start|stop|reload|force-reload|restart} "
        exit 1
        ;;
esac

Wednesday, January 4, 2012

Really, Brother?

This is popping up on my screen every five minutes.


Really? Ink Low?
Doesn't look low to me, and certainly not low enough to be BUGGING ME EVERY FIVE MINUTES.

I'd expect it to be complaining at 15%-25%, not "hey, your black dropped below 50%!"

I think I'm going to change the printer's assigned hostname from the router to 'navi'.
"HEY, LISTEN! HEY, LISTEN! HEY, LISTEN!"

Friday, December 9, 2011

1976 Jaguar XJ-12 with Chevy 350 For Sale!

Hello, all my friends on the internet reading this.

My friends and I are in a bit of a rough spot. We're sort of short on the rent, this month. Y'see, we're about 45 days into bootstrapping a little film business here in california, trying to run things in a 'stack-all-the-added-value' sort of way. We've got some fancy camera gear (Epic X & 5D Mk2, KesslerCrane 12' Jib, Zoom H4N & Mics), but it ain't all ours yet. We rented a fancy location to shoot and live in, but it ain't all ours yet. We're still linking up with people and pitching for jobs.

Here's some of the awesomeness we've thrown together in the last few weeks:



As part of our awesome film gear, we had to have an awesome car to film. She shows up in the first clip.



It's Nate North's Silver Jaguar XJ-12.



She's had her Jaguar V-12 engine replaced about 10000 miles ago with a reliable Chevy V-8 350, since the Jaguar has a relatively standard GM-compatible driveline. There are two gas tanks with a dashboard console button to switch between them.



I believe it also has a T700-R4 transmission with a 30% overdrive, so for a V8, it does pretty well on the road.
She's all mechanical, so if you're looking to increase milage, HHO Kits Direct has some pretty awesome holiday deals right now.
Plenty of room under her hood, Power windows, Heater, Working AC, Viper car alarm controlling power locks, spiffy clean red interior.



Anyway, I'll get to the point.  Sadly, we're going to have to let her go. But I'd like her to find a good home.
She'd make a wonderful holiday gift for a car tinkerer. That's where you come in, internet.




To make sure my friends have a cheerful holiday, I'm willing to pack her on a U-Haul car-hauler off the back of a 10' U-Haul truck,
and drive her to any destination out to as far as, maybe Texas, maybe further.
I'm willing to show up at your place, christmas evening or morning to unload her, then take a Greyhound back home to Los Banos.



Right now, we're asking $7000, or taking the best offer we get.

I'm sorta hoping there's someone out there with some holiday spirit willing to keep us burning into January with a little more to eat with; but we are humble folk, and will continue on our diet of homemade bisquick pan-pizzas and spaghetti with various sauces. Inexpensive, yet delicious!

Alternatively... If you don't want the car, We're for hire doing all sorts of things... :)


Pass this around your G+ Circles, give us a holler here in the comments, send me an email at Kamilion@gmail.com, a voicemail* at (408) 890-7463, or track down one of my housemates on the internet, we'd love to hear from you!

* My apologies, I have run out of money to pay T-Mobile this month, but Google Voice will still be happy to transcribe your message and email it to me!

Thursday, December 8, 2011

"Asking questions is important, because that's when intuition gets converted into inspiration."


So I changed my email signature recently and trimmed out some of the quotes in it.
I got an email from a friend of mine who noticed, and happened to ask about who the author of the quotes were.

The answer is: Me!

"Asking questions is important, because that's when intuition gets converted into inspiration."

Let me give you an example, I call it:


"How to learn CSS in 40 minutes."

Many thanks to wraith of Lytedev.com for his assistance!



[15:20:46] [Kamilion] cause you scrolled my CSS question off the screen when wraith came back
[15:20:56] [wraith] sorry
[15:21:02] [wraith] little brother has a play - about to leave
[15:21:09] [Kamilion] wraith: ah, no worries then
[15:21:09] [wraith] what's the Q, Kami?
[15:21:16] [wraith] I got ~20 mins
[15:21:16] [Kamilion] oh okay
[15:21:32] [Kamilion] I have a "CSS" field here in drupal
[15:21:43] [Kamilion] and I'm trying to figure out what to stuff in it
[15:22:11] [wraith] pic/
[15:22:13] [wraith] ?
[15:22:20] [wraith] I need a context...
[15:22:38] [wraith] it's probably the class that it's identified as by the CSS
[15:22:45] [wraith] but I dunno
[15:23:29] [Kamilion] Styles for regions
[15:23:29] [Kamilion]  
[15:23:29] [Kamilion] Configure styles which you can add to regions on the "manage display" screens. Add multiple styles line per line.
[15:23:29] [Kamilion] If you want to have a friendly name, separate class and friendly name by |, but this is not required. eg:
[15:23:29] [Kamilion] class_name_1
[15:23:29] [Kamilion] class_name_2|Friendly name
[15:23:29] [Kamilion] class_name_3
[15:23:54] [Kamilion] so it's asking for a CSS class
[15:24:10] [wraith] yeah - classes basically say how an element can be referenced or get'd
[15:24:14] [Kamilion] http://files.sllabs.com/files/theme/style.css
[15:24:19] [Kamilion] there's the existing classes
[15:24:31] [Kamilion] and I'm trying to figure out how to call one, ANY of them
[15:24:32] [wraith] well you give it classes based on what styles you want it to inherit
[15:25:08] [Kamilion] I got that part
[15:25:12] [Kamilion] but like
[15:25:16] [wraith] so if there are styles for the ".green-button" class that you want your element to inherit, you would give it the "green-button" class
[15:25:36] [Kamilion] ah after the dot is the class?
[15:25:41] [wraith] yep
[15:25:43] [Kamilion] what's the #thisthingcalled
[15:25:46] [wraith] . identifies classes
[15:25:49] [wraith] # identifies ids
[15:25:53] [Kamilion] ids
[15:25:55] [Kamilion] okay
[15:26:00] [Kamilion] so that's a CSS ID
[15:26:03] [wraith] and no symbol prefix means an html element
[15:26:06] [Kamilion] and the . below is the classes
[15:26:10] [Kamilion] yeah
[15:26:13] [Kamilion] I saw those at the top
[15:26:21] [wraith] yep - they're generally declared first
[15:26:26] [Kamilion] figured that was 'do this for any html element you see by default'
[15:26:32] [wraith] yup
[15:26:37] [Kamilion] then clearfix
[15:26:40] [Kamilion] which i read up on
[15:26:51] [Kamilion] fixes z order for things like colorboxes
[15:27:12] [wraith] and helps re-heighten blocks which contain floated elements
[15:27:13] [wraith] yep
[15:27:14] [Kamilion] cause it's definied at the top after the html elements
[15:27:25] [wraith] yeah - it's an important helper class to have 
[15:27:36] [Kamilion] but then I'm kinda lost
[15:27:42] [Kamilion] it starts defining IDs
[15:27:50] [wraith] yeah - stylesheets get pretty big pretty fast
[15:27:57] [wraith] so what you wanna do is this:
[15:28:02] [wraith] find other elements on the page
[15:28:12] [wraith] that have the style you want for your new element
[15:28:15] [wraith] see which classes it's got
[15:28:21] [wraith] and give your element the same classes
[15:28:28] [wraith] it will therefore inherit the same styles
[15:28:39] [wraith] and if everything is done right, you will have successfully imitated the element
[15:28:45] [wraith] if you're wanting to make something new
[15:29:02] [wraith] you'll have to find different elements that seem to have bits and pieces of the styles you want to inherit
[15:29:03] [Kamilion] .footer-gallery-block { width: 260px; } 
[15:29:03] [Kamilion] .footer-gallery-block img { background-color: #191F2F; border: 1px solid #252C3E; float: left; margin-bottom: 10px; margin-right: 9px; padding: 5px; }
[15:29:03] [Kamilion] #footer ul.twitter { -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; background: url("images/tweetbg.png") repeat scroll 0 0 transparent;
[15:29:03] [Kamilion] list-style-type: none; padding: 10px; width: 280px; margin-left:0; }
[15:29:24] [Kamilion] that appears in the middle of a bunch of #footer stuff above it
[15:29:32] [Kamilion] but the gallery block doesn't have the ID defined
[15:29:42] [wraith] Kamilion: is this still lensipedia?
[15:29:43] [Kamilion] and then they pick up with the same ID after the gallery block
[15:29:44] [Kamilion] yeah
[15:29:54] [Kamilion] bout halfway down that style.css
[15:30:02] [Kamilion] http://files.sllabs.com/files/theme/style.css
[15:30:26] [wraith] got it
[15:30:35] [Kamilion] I think I want to be dealing in the node area, which is just below that
[15:30:46] [Kamilion] since that's where most of my 'content' is displayed
[15:30:52] [Kamilion] but there's no id there
[15:30:57] [wraith] so what kind of elements are you trying to create here?
[15:31:04] [wraith] what's it supposed to do and be?
[15:31:19] [Kamilion] Well, I've got a couple things I want to do
[15:31:34] [Kamilion] first, I want to define a non-repeating background image for some of these articles
[15:31:43] [Kamilion] but only on some *types* of articles
[15:31:52] [wraith] gotcha
[15:31:52] [Kamilion] eg, canon_lenses but not nikon_lenses, for now
[15:32:03] [wraith] so then you want to make a class
[15:32:10] [Kamilion] so I need to figure out what both of those have in common
[15:32:37] [wraith] yep
[15:32:39] [Kamilion] and then choose a specific image based on, eg, the article's content type
[15:32:40] [wraith] node-canon-lens
[15:32:43] [wraith] that's the class
[15:32:54] [Kamilion] it's making some?
[15:32:57] [wraith] yeah
[15:33:05] [Kamilion] and there's just nothing attached to that in the css
[15:33:17] [wraith] so then you need to put in what you want
[15:33:23] [wraith] that is, a non-repeating background-image
[15:33:42] [Kamilion] okay, second task;
[15:34:04] [Kamilion] http://lensapedia.com/tags/canon-lens?page=6
[15:34:06] [Bottien] Title: Canon Lens | lensapedia.com (at lensapedia.com)
[15:34:13] [Kamilion] this is a 3-column layout
[15:34:20] [Kamilion] I can add a css class to each column
[15:34:33] [Kamilion] i want to add this to the 'right' column
[15:34:51] [Kamilion] where the retail price and stuff is
[15:34:56] [Kamilion] then style those elements
[15:35:14] [wraith] that's class "group-right"
[15:35:14] [Kamilion] what is my workflow for finding these elements and styling them?
[15:35:18] [wraith] so in the stylesheet
[15:35:21] [wraith] you'll wanna reference
[15:35:35] [wraith] .ds-3col-stacked .group right { /* CSS */ }
[15:35:48] [wraith] you using chrome?
[15:35:50] [Kamilion] yeah
[15:35:52] [Kamilion] chromium 17
[15:36:04] [wraith] right click the element, inspect element
[15:36:09] [wraith] be sure it's really your element
[15:36:18] [Kamilion] k, I think I see it
[15:36:22] [Kamilion] yeah
[15:36:24] [wraith] if not, hover around until you find the box that encompasses your element
[15:36:24] [Kamilion] class grou-right
[15:36:24] [wraith] then
[15:36:29] [wraith] just look at the classes
[15:36:29] [Kamilion] then a bunch of fields
[15:36:31] [Kamilion] okay
[15:36:32] [wraith] space-separated
[15:36:48] [Kamilion] right, so field effects them all, field-name-field-msrp
[15:36:56] [wraith] right
[15:37:11] [Kamilion] that will tag only that field
[15:37:11] [wraith] elements can have multiple classes
[15:37:13] [wraith] any of which
[15:37:18] [wraith] can select that element
[15:37:20] [wraith] right
[15:37:21] [wraith] you got it
[15:37:44] [Kamilion] so this is #group-right .field-name-field { do-it-here:stuff }
[15:37:44] [wraith] it's kinda like OOP
[15:37:50] [wraith] nope
[15:37:55] [wraith] .group-right
[15:37:58] [wraith] not #group-right
[15:38:03] [wraith] since it's a class
[15:38:05] [wraith] not an id
[15:38:19] [wraith] 'class="group-right"' not 'id="group-right"'
[15:38:27] [Kamilion] okay so if I wanted to dick with field-name-field-msrp
[15:38:37] [Kamilion] which is under group-right
[15:38:39] [Kamilion] in the html
[15:38:50] [wraith] .group-right .field-name-field-msrp { /* CSS */ }
[15:38:56] [Kamilion] AH.
[15:39:00] [wraith] . selects classes, # selects ids
[15:39:06] [wraith] so you'll generally use .
[15:39:15] [Kamilion] Oh I see, so I'm doing the selectors inside the CSS itself
[15:39:20] [wraith] yep
[15:39:29] [Kamilion] see, this is why I needed a people
[15:39:37] [wraith] I understand =D
[15:39:41] [Kamilion] all the books and all the kings blog posts couldn't put humpty dumpty together
[15:39:50] [Kamilion] rightyo
[15:40:04] [Kamilion] so lemme syntax this one
[15:40:40] [Kamilion] .group-right .field-name-field-msrp { background: url("images/tweetbg.png") repeat scroll 0 0 transparent; }
[15:41:03] [Kamilion] that would ONLY affect MSRP if it was in that right handed box
[15:41:04] [wraith] sounds good
[15:41:08] [wraith] yep
[15:41:12] [Kamilion] if I moved the field to the left handed box
[15:41:15] [wraith] or in AN right-handed box
[15:41:18] [wraith] ANY*
[15:41:18] [Kamilion] say inside the actual clicky article
[15:41:27] [Kamilion] then I could style it totally differently
[15:41:29] [wraith] then it won't style it that specific way, right
[15:41:31] [wraith] yep
[15:41:40] [wraith] it has to meet all the selectors in the html and in that order
[15:41:50] [Kamilion] ... All of them?
[15:41:55] [wraith] yep
[15:42:55] [Kamilion] so if field-type-number-float is never defined [15:43:03] [Kamilion] then it's just ignored in the html until I go and define it [15:43:18] [wraith] right [15:43:26] [wraith] because the CSS will never go look for it [15:43:45] [Kamilion] okay, so where in this style.css would I put that? [15:43:49] [wraith] anywhere [15:43:50] [wraith] but, keep it organized, so [15:44:02] [wraith] preferrably with similar selections [15:44:08] [Kamilion] .group-right .field-name-field-msrp { background: url("images/tweetbg.png") repeat scroll 0 0 transparent; } [15:44:16] [Kamilion] should I put that under the node comment? [15:44:29] [Kamilion] since that's where in my mind, I'm wanting it applied? [15:44:51] [wraith] yep [15:44:54] [Kamilion] then go into defining links and search blocks under there [15:44:54] [wraith] however it works in your mind [15:45:02] [wraith] my personal way, is to go from top to bottom [15:45:10] Kamilion nods [15:45:12] [wraith] so I start with the body, (and any other html elements) [15:45:14] [wraith] then move down [15:45:15] [wraith] header, [15:45:16] [wraith] content [15:45:18] [wraith] sidebar [15:45:21] [wraith] footer [15:45:30] [wraith] and put everything kind of in order that way [15:45:32] [wraith] however [15:45:39] [wraith] that's not how most people do it, but do it how you see fit [15:45:48] [Kamilion] well, under the searchblock they define specific behavior for, the front page image slideshow, and some other minor html 'extras' [15:45:59] [Kamilion] tr.even and tr.odd [15:46:06] [wraith] yeah [15:46:17] [wraith] what you could also do [15:46:22] [Kamilion] when the credits were referenced, they were also at the bottom of the page [15:46:25] [wraith] is just keep user-defines stuff at the VERY bottom [15:46:25] [Kamilion] but [15:46:29] [Kamilion] Ahh [15:46:30] [Kamilion] okay [15:46:36] [Kamilion] there's already a few of those [15:46:45] [wraith] well there ya go - that'll work just fine too [15:46:47] [Kamilion] but like [15:46:56] [Kamilion] just above the credits section is the 'top social network icons' [15:46:56] [wraith] that way if you every change templates, you know which stuff is yours [15:47:03] [Kamilion] meaning the social network icons in the top bar of the site [15:47:06] [Kamilion] above even the header [15:47:10] [Kamilion] where the search box is [15:47:16] [wraith] yeah, like I said, most people don't do it the way I do [15:47:20] Kamilion nods [15:47:24] [Kamilion] anyway [15:47:31] [Kamilion] thanks for the help man, go support your little brother [15:47:37] [wraith] np - cya later =) [15:47:39] [Kamilion] Much appreciated. [15:47:43] Kamilion save-logs [15:47:46] [wraith] absolutely [15:48:09] Kamilion holds CSS over his head [15:48:11] [wraith] lol [15:48:12] [wraith] ok [15:48:14] [Kamilion] Da na na NAAA [15:48:15] [wraith] bbl [15:48:18] Kamilion waves

Thursday, March 24, 2011

OOPs, time to catch up to the rest of the internet...

"Object-oriented programming is eliminated entirely from the introductory curriculum, because it is both anti-modular and anti-parallel by its very nature, and hence unsuitable for a modern CS curriculum.  A proposed new course on object-oriented design methodology will be offered at the sophomore level for those students who wish to study this topic."


https://existentialtype.wordpress.com/2011/03/15/teaching-fp-to-freshmen/
http://lwn.net/Articles/434745/

Finally. Advocating Object-Oriented Programming is like advocating Pants-Oriented Clothing.

Tuesday, September 14, 2010

Parsing HTML with Cthulhu

You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML. Regular expressions are a tool that is insufficiently sophisticated to understand the constructs employed by HTML. HTML is not a regular language and hence cannot be parsed by regular expressions. Regex queries are not equipped to break down HTML into its meaningful parts. so many times but it is not getting to me. Even enhanced irregular regular expressions as used by Perl are not up to the task of parsing HTML. You will never make me crack. HTML is a language of sufficient complexity that it cannot be parsed by regular expressions. Even Jon Skeet cannot parse HTML using regular expressions. Every time you attempt to parse HTML with regular expressions, the unholy child weeps the blood of virgins, and Russian hackers pwn your webapp. Parsing HTML with regex summons tainted souls into the realm of the living. HTML and regex go together like love, marriage, and ritual infanticide. The <center> cannot hold it is too late. The force of regex and HTML together in the same conceptual space will destroy your mind like so much watery putty. If you parse HTML with regex you are giving in to Them and their blasphemous ways which doom us all to inhuman toil for the One whose Name cannot be expressed in the Basic Multilingual Plane, he comes. HTML-plus-regexp will liquify the n​erves of the sentient whilst you observe, your psyche withering in the onslaught of horror. Rege̿̔̉x-based HTML parsers are the cancer that is killing StackOverflow it is too late it is too late we cannot be saved the trangession of a chi͡ld ensures regex will consume all living tissue (except for HTML which it cannot, as previously prophesied)dear lord help us how can anyone survive this scourge using regex to parse HTML has doomed humanity to an eternity of dread torture and security holes using regex as a tool to process HTML establishes a breach between this world and the dread realm of c͒ͪo͛ͫrrupt entities (like SGML entities, butmore corrupt) a mere glimpse of the world of reg​ex parsers for HTML will ins​tantly transport a programmer's consciousness into a world of ceaseless screaming, he comes, the pestilent slithy regex-infection wil​l devour your HT​ML parser, application and existence for all time like Visual Basic only worse he comes he comes do not fi​ght he com̡e̶s, ̕h̵i​s un̨ho͞ly radiańcé destro҉ying all enli̍̈́̂̈́ghtenment, HTML tags lea͠ki̧n͘g fr̶ǫm ̡yo​͟ur eye͢s̸ ̛l̕ik͏e liq​uid pain, the song of re̸gular exp​ression parsing will exti​nguish the voices of mor​tal man from the sp​here I can see it can you see ̲͚̖͔̙î̩́t̲͎̩̱͔́̋̀ it is beautiful t​he final snuffing of the lie​s of Man ALL IS LOŚ͖̩͇̗̪̏̈́T ALL I​S LOST the pon̷y he comes he c̶̮omes he comes theich​or permeates all MY FACE MY FACE ᵒh god no NO NOO̼O​O NΘ stop the an​*̶͑̾̾​̅ͫ͏̙̤g͇̫͛͆̾ͫ̑͆l͖͉̗̩̳̟̍ͫͥͨe̠̅s ͎a̧͈͖r̽̾̈́͒͑e n​ot rè̑ͧ̌aͨl̘̝̙̃ͤ͂̾̆ ZA̡͊͠͝LGΌ ISͮ̂҉̯͈͕̹̘̱ TO͇̹̺ͅƝ̴ȳ̳ TH̘Ë͖́̉ ͠P̯͍̭O̚​N̐Y̡ H̸̡̪̯ͨ͊̽̅̾̎Ȩ̬̩̾͛ͪ̈́̀́͘ ̶̧̨̱̹̭̯ͧ̾ͬC̷̙̲̝͖ͭ̏ͥͮ͟Oͮ͏̮̪̝͍M̲̖͊̒ͪͩͬ̚̚͜Ȇ̴̟̟͙̞ͩ͌͝S̨̥̫͎̭ͯ̿̔̀ͅ







Want your own psychopathic crazy text? http://www.textozor.com/ serves all your smudged and blotted needs.

Thursday, August 26, 2010

Malware and Virus Scans

So, a lot of my associates are Windows users out of necessity.

Got an email this morning:
"Our pc's fans started goin off again on full blast. We already did the virus detection and surprisngly it found viruses and deleted them. But today it started on full blast again. Any ideas?"

... Stop letting people use Internet Explorer? ;)

There's some .PDF, Flash, and JAVA vulnerabilities going around now; make sure you patch up your Adobe Reader and Flash Player to current, Update your JAVA to 6u22 or higher, run TFC.exe and then run a malware bytes scan.

After MBAM finishes cleaning up; go into the Windows Scheduled Tasks in control panel and remove any suspicious jobs (Lot of the nasty ones are untitled and look like a GUID like
"{21EC2020-3AEA-1069-A2DD-08002B30309D}")

Then fire up process explorer, Options Menu -> Verify Image Signatures, View -> Select Columns and make sure "Verified Signer" is checkboxed, View -> Show Process Tree, click the - by wininit.exe to hide system services and kill off anything that doesn't have an entry in the Company Name field. (Kill *Any* Unsigned EXEs, even stuff from Logitech mouse drivers and Realtek audio controls)

In fact, you can usually prune every user process off except for the root Explorer.exe process.
If you're careful, you can even kill off most services other than svchost.exe and
anything with "(Verified) Microsoft Windows" in the Verified Signer column.

Then fire up autoruns.exe and remove any suspicious startup entries. Heck, if you can, remove everything but the nvidia/ATI driver autoruns.

Now run TFC.exe once more to make sure all the tempdirs are emptied.

Alternatively, you can run an offline scan with a bootcd like AVIRA's Rescue CD -- the ISOs are updated weeklyish.

http://dlpro.antivir.com/package/rescue_system/common/en/rescue_system-common-en.exe

AVAST's also a good option.
http://www.avast.com/free-antivirus-download

Your best choice is to get ChromeChromium, or Firefox and load them with the Adblock and PDF Download extension that prompts you to download PDFs -- just click cancel if the prompt comes up unless you intentionally clicked a PDF link yourself.

Myself, I use Chromium and Chrome Adblock. Chromium has an internal PDF renderer that doesn't rely on Adobe, and it's sandboxed by default. You can enable it from chrome://plugins/ which also will warn you if other plugins are not up to date.



Still, it pays to be careful.
If you'd like to see how sophisticated some of these attacks are, check out this series of articles:
http://www.h-online.com/security/features/CSI-Internet-HQ-1050609.html