Software, Physics, Data, Mountains

...and other random associations

Osx Startup Scripts

edit Library/LaunchAgents/hawk.videos.sshfs.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>hawk.videos.sshfs</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/bin/sshfs-authsock</string>
                <string>mmm@hawk:/home/mmm/Videos</string>
                <string>/mnt/hawk</string>
                <string>-oreconnect</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>AbandonProcessGroup</key>
        <true/>
</dict>
</plist>

now, just

launchctl load ~/Library/LaunchAgents/hawk.videos.sshfs.plist
launchctl start hawk.videos.sshfs

VM Buildout Notes for Dlb

added sources.list

packages:

ruby
rdoc ri irb
build-essential
ruby1.8-dev
libapache2-mod-fcgid
libfcgi-dev
libxml2
libxml2-dev
libxslt1-dev
sqlite3
libsqlite3-dev
mysql-server (had to force this for some reason ... bitching about locale not being set)
libmysql-ruby1.8
libdbd-mysql-ruby
libmysqlclient15-dev
rsync
screen
libopenssl-ruby


apt-get update
apt-get -u upgrade
apt-get -u dist-upgrade

install rubygems in /usr/local

install gems rails mongrel mongrel_cluster passenger capistrano capistrano-ext fcgi ferret haml hpricot htmlentities nokogiri mechanize cucumber mocha open4 runt spreadsheet sqlite3 termios will_paginate

adduser --home /usr/local/dlb dlb

rsync /usr/local/dlb over to VM

scp /etc/apache2/sites-available/dlb-sites over to VM

test to get apache up

test to get rails up

apache config for mods-enabled: ln -s ../mods-available/deflate.conf . ln -s ../mods-available/deflate.load . ln -s ../mods-available/file_cache.load . ln -s ../mods-available/mem_cache.load . ln -s ../mods-available/mem_cache.conf . ln -s ../mods-available/headers.load . ln -s ../mods-available/proxy_balancer.load . ln -s ../mods-available/proxy.conf ln -s ../mods-available/proxy_http.load . ln -s ../mods-available/proxy.load . ln -s ../mods-available/rewrite.load . ln -s ../mods-available/include.load . ln -s ../mods-available/cache.load .

Use Usb Keys for Openmicroserver Firewalls

backup image in ~/etc/arch/machine-backups/korek-xxxxxxxx.tar.gz

ganymede:~/etc/arch/machine-backups # fdisk -l /dev/sdc

Disk /dev/sdc: 2029 MB, 2029518848 bytes
255 heads, 63 sectors/track, 246 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xc3072e18

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         208     1670728+  83  Linux
/dev/sdc2             209         246      305235   82  Linux swap / Solaris
ganymede:~/etc/arch/machine-backups # 

Repair Mysql

mysql> check
    -> table products;
+---------------------------+-------+----------+---------------------------------------------------------+
| Table                     | Op    | Msg_type | Msg_text                                                |
+---------------------------+-------+----------+---------------------------------------------------------+
| dlbeduca_dbbooks.products | check | warning  | Table is marked as crashed                              |
| dlbeduca_dbbooks.products | check | error    | Checksum for key:  3 doesn't match checksum for records |
| dlbeduca_dbbooks.products | check | error    | Checksum for key: 10 doesn't match checksum for records |
| dlbeduca_dbbooks.products | check | error    | Corrupt                                                 |
+---------------------------+-------+----------+---------------------------------------------------------+
4 rows in set (4.26 sec)

mysql> quit
Bye
You have new mail in /var/spool/mail/dlb
[dlb@linode ~]$ mysqlcheck -udlb_user -pdlb_user --repair --extended dlbeduca_dbbooks
dlbeduca_dbbooks.address_book                      OK
dlbeduca_dbbooks.address_format                    OK
dlbeduca_dbbooks.administrators                    OK
dlbeduca_dbbooks.banners                           OK
dlbeduca_dbbooks.banners_history                   OK
dlbeduca_dbbooks.catalog_books
note     : The storage engine for the table doesn't support repair
dlbeduca_dbbooks.catalog_users
note     : The storage engine for the table doesn't support repair
dlbeduca_dbbooks.catalogs
note     : The storage engine for the table doesn't support repair
dlbeduca_dbbooks.categories                        OK
dlbeduca_dbbooks.categories_description            OK
dlbeduca_dbbooks.configuration                     OK
dlbeduca_dbbooks.configuration_group               OK
dlbeduca_dbbooks.counter                           OK
dlbeduca_dbbooks.counter_history                   OK
dlbeduca_dbbooks.countries                         OK
dlbeduca_dbbooks.currencies                        OK
dlbeduca_dbbooks.customers                         OK
dlbeduca_dbbooks.customers_basket                  OK
dlbeduca_dbbooks.customers_basket_attributes       OK
dlbeduca_dbbooks.customers_info                    OK
dlbeduca_dbbooks.duplicate_isbn                    OK
dlbeduca_dbbooks.geo_zones                         OK
dlbeduca_dbbooks.imports
note     : The storage engine for the table doesn't support repair
dlbeduca_dbbooks.languages                         OK
dlbeduca_dbbooks.manufacturers                     OK
dlbeduca_dbbooks.manufacturers_info                OK
dlbeduca_dbbooks.newsletters                       OK
dlbeduca_dbbooks.orders                            OK
dlbeduca_dbbooks.orders_products                   OK
dlbeduca_dbbooks.orders_products_attributes        OK
dlbeduca_dbbooks.orders_products_download          OK
dlbeduca_dbbooks.orders_status                     OK
dlbeduca_dbbooks.orders_status_history             OK
dlbeduca_dbbooks.orders_total                      OK
dlbeduca_dbbooks.products                          OK
dlbeduca_dbbooks.products1                         OK
dlbeduca_dbbooks.products_attributes               OK
dlbeduca_dbbooks.products_attributes_download      OK
dlbeduca_dbbooks.products_description              OK
dlbeduca_dbbooks.products_description1             OK
dlbeduca_dbbooks.products_notifications            OK
dlbeduca_dbbooks.products_options                  OK
dlbeduca_dbbooks.products_options_values           OK
dlbeduca_dbbooks.products_options_values_to_products_options OK
dlbeduca_dbbooks.products_to_categories            OK
dlbeduca_dbbooks.reviews                           OK
dlbeduca_dbbooks.reviews_description               OK
dlbeduca_dbbooks.schema_migrations
note     : The storage engine for the table doesn't support repair
dlbeduca_dbbooks.sessions                          OK
dlbeduca_dbbooks.settings                          OK
dlbeduca_dbbooks.specials                          OK
dlbeduca_dbbooks.sphinx_searches                   OK
dlbeduca_dbbooks.tax_class                         OK
dlbeduca_dbbooks.tax_rates                         OK
dlbeduca_dbbooks.test                              OK
dlbeduca_dbbooks.whos_online                       OK
dlbeduca_dbbooks.zones                             OK
dlbeduca_dbbooks.zones_to_geo_zones                OK
You have new mail in /var/spool/mail/dlb
[dlb@linode ~]$ mysql -udlb_user -pdlb_user dlbeduca_dbbooks
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8670
Server version: 5.1.42 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> check table products;
+---------------------------+-------+----------+----------+
| Table                     | Op    | Msg_type | Msg_text |
+---------------------------+-------+----------+----------+
| dlbeduca_dbbooks.products | check | status   | OK       |
+---------------------------+-------+----------+----------+
1 row in set (1.11 sec)

mysql> quit
Bye

Clone Kvm Vm

mkdir /usr/local/kvm/newvm
cd /usr/local/kvm/newvm

# this didn't work...
#virt-clone --original oldvm --name newvm --file /usr/local/kvm/newvm/root.qcow2 

# this did
virt-clone --connect=qemu:///system -o oldvm -n newvm -f /usr/local/kvm/newvm/root.qcow2

Best Format for External Drive

/dev/sdi1 on /media/Elements type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)

wtf is fuseblk? looks like it’s fuse’s version of an ntfs mount


hawk():/media/Elements # fdisk -l /dev/sdi

Disk /dev/sdi: 1000.2 GB, 1000202043392 bytes
255 heads, 63 sectors/track, 121600 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00021631

   Device Boot      Start         End      Blocks   Id  System
/dev/sdi1               1      121601   976758784    7  HPFS/NTFS

some shit on the net about when it’s in an fstab, it needs to be ntfs-3g

/dev/sda1               /mnt/winxp              ntfs-3g user,umask=0000 0 0
/dev/sda2               /mnt/fat32              vfat    user,umask=0000 0 0

Share Wireless Through Eth0

Share ganymede’s wifi (eth1) connection out through eth0

Bonus: plug helga into eth0 and re-share wireless over helganet

on ganymede, set up eth0.

/etc/network/interfaces… add:

auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
  address 192.168.20.254
  netmask 255.255.255.0

/etc/default/iptables… should read:

*nat
:PREROUTING ACCEPT [7126:609382]
:POSTROUTING ACCEPT [25:2066]
:OUTPUT ACCEPT [32:4056]
-A POSTROUTING -o eth1 -s 192.168.20.0/24 -d ! 192.168.20.0/24 -j MASQUERADE 
#-A PREROUTING -d 216.82.212.101/32 -p tcp --dport 80 -j DNAT --to 10.12.10.1:80
COMMIT

*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [8409:705642]
:LOGDROP - [0:0]
:NEVER - [0:0]
:external-if - [0:0]
:external-internal - [0:0]
:icmp-accept - [0:0]
:internal-external - [0:0]
:internal-if - [0:0]

-A LOGDROP -m limit --limit 3/hour -j LOG --log-prefix "filter: " 
-A LOGDROP -j DROP 

-A NEVER -j LOG --log-prefix "filter ERROR: " --log-level 1 
-A NEVER -j DROP 

-A external-if -m state --state RELATED,ESTABLISHED -j ACCEPT 
-A external-if -p icmp -m icmp --icmp-type 0 -j ACCEPT 
-A external-if -j icmp-accept 
-A external-if -j DROP 

#-A internal-if -s 192.168.20.0/24 -p tcp --dport 22 -j ACCEPT
-A internal-if -s 192.168.20.0/24 -j ACCEPT
-A internal-if -p icmp -m icmp --icmp-type 0 -j ACCEPT 
-A internal-if -j icmp-accept 
-A internal-if -j DROP 

-A icmp-accept -p icmp -m icmp --icmp-type 8 -j ACCEPT 
-A icmp-accept -p icmp -m icmp --icmp-type 11 -j ACCEPT 
-A icmp-accept -p icmp -m icmp --icmp-type 3 -j ACCEPT 
-A icmp-accept -p icmp -m icmp --icmp-type 4 -j ACCEPT 
-A icmp-accept -p icmp -m icmp --icmp-type 11 -j ACCEPT 
-A icmp-accept -p icmp -m icmp --icmp-type 12 -j ACCEPT 

-A external-internal -m state --state RELATED,ESTABLISHED -j ACCEPT 
-A external-internal -p tcp -m tcp --sport 22 ! --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT 
#-A external-internal -p tcp -o eth0 -d 192.168.100.2 --dport 22 -m state --state NEW -j ACCEPT
-A external-internal -p icmp -m icmp --icmp-type 0 -j ACCEPT 
-A external-internal -j DROP 

-A internal-external -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT 
-A internal-external -j DROP 

-A INPUT -i eth1 -j external-if 
-A INPUT -i eth0 -j internal-if 

-A FORWARD -i eth1 -o eth0 -j external-internal 
-A FORWARD -i eth0 -o eth1 -j internal-external 
-A FORWARD -j NEVER 

COMMIT

of course you need to turn on ip forwarding

echo "1" > /proc/sys/net/ipv4/ip_forwarding

and uncomment lines in /etc/sysctl.conf

Also need a dhcpd server running with /etc/dhcp3/dhcpd.conf containing

subnet 192.168.20.0 netmask 255.255.255.0 {
  range 192.168.20.10 192.168.20.20;
  option routers 192.168.20.254;
  option domain-name "globalsuite.net";
  option domain-name-servers 4.2.2.1;
}

but could probably do this easier with dnsmasq.

Ca y est!