When aliens invade Earth, be first to warn your neighbours by placing your computer screen at a window and executing this potentially Earth-saving command.

Ctrl C when aliens are defeated.

Diff your entire server config at ScriptRock.com

]]>to include hidden dirs use:

`tree -adL 1`

(with ls, requires 'ls -ad */ .*/')

Diff your entire server config at ScriptRock.com

]]>Remounts a usb disk /dev/sdb, without having to physically remove and reinsert. (Gnome desktop)

Diff your entire server config at ScriptRock.com

]]>for one line per process:

`ss -p | cat`

for established sockets only:

`ss -p | grep STA`

for just process names:

`ss -p | cut -f2 -sd\"`

or

`ss -p | grep STA | cut -f2 -d\"`

Diff your entire server config at ScriptRock.com

]]>Get sopcast links for live sports from http://myp2p.eu (for example)

Get sp-sc or sp-auth binary by googling (sopcast + linux)

eg http://www.jbg.f2s.com/sp-sc.gz

Requires the 32bit libstdc++5 package.

After exiting mplayer, type 'killall sp-sc'

Diff your entire server config at ScriptRock.com

]]>Diff your entire server config at ScriptRock.com

]]>in place of warptv use shagadelictv, edgetv, agingtv, dicetv, vertigotv, revtv or quarktv (see 'gst-inspect-0.10 effectv'. Requires gstreamer-plugins-good (or gstreamer0.10-plugins-good ).

For slow webcams use something like

`gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! warptv ! ffmpegcolorspace ! autovideosink`

.

For basic webcam view via gstreamer use

`gst-launch-0.10 v4l2src ! autovideosink`

Diff your entire server config at ScriptRock.com

]]>emulates bash4's "echo {03..20}"

Uses bash3 builtin function printf

Diff your entire server config at ScriptRock.com

]]>Flips the y-axis to emulate a real mirror, uses low resolution for speed, this will also hide blemishes and the like :)

Diff your entire server config at ScriptRock.com

]]>Quick command to test your webcam. Press 'f' to toggle fullscreen. Can also use 'vlc v4l2://' if you want gui controls. For higher/smoother framerate lower the default resolution:

`cvlc v4l2:// :v4l2-width=320 :v4l2-height=240 &`

Diff your entire server config at ScriptRock.com

]]>Launch a gui app remotely. In this example smplayer is installed on the remote machine, and movie.avi is in the remote user's home dir. Note that stdout/stderr is still local, so you'll have feedback locally, add '&>/dev/null' to suppress. This is surprisingly not well known (compared to running an X app locally via ssh -X). (NB. if your distro requires ~/.Xauthority file present, then try -fX if you have problems)

Resubmitted (and trimmed, thanks sitaram) due to ridiculous voting on previous submission. Fingers crossed, it gets a better rating this time.

Diff your entire server config at ScriptRock.com

]]>The end of unix time and the 32bit era will be Tue Jan 19 03:14:07 UTC 2038

.

`date -ud @$[2**31]`

date: invalid date `@2147483648'

.

In 64bit you have much longer, at least to:

`date -ud @$[2**55]`

`Sun Jun 13 06:26:08 UTC 1141709097`

Diff your entire server config at ScriptRock.com

]]>EDIT: Trolling crap removed ;)

takes approx 6 secs on a Core 2 Duo @ 2GHz, and 15 secs on atom based netbooks!

uses monoid (a,b).(x,y)=(ax+bx+ay,ax+by) with identity (0,1), and recursion relations:

F(2n-1)=Fn*Fn+F(n-1)*F(n-1)

F(2n)=(Fn+2*F(n-1))*Fn

then apply fast exponentiation to (1,0)^n = (Fn,F(n-1))

.

Note that: (1,0)^-1=(1,-1) so (a,b).(1,0) = (a+b,a) and (a,b)/(1,0)=(a,b).(1,0)^-1=(b,a-b)

So we can also use a NAF representation to do the exponentiation,http://en.wikipedia.org/wiki/Non-adjacent_form , it's also very fast (about the same, depends on n):

`time echo 'n=1000000;m=(n+1)/2;a=0;b=1;i=0;while(m>0){z=0;if(m%2)z=2-(m%4);m=(m-z)/2;e[i++]=z};while(i--){c=a*a;a=c+2*a*b;b=c+b*b;if(e[i]>0){t=a;a+=b;b=t};if(e[i]<0){t=a;a=b;b=t-b}};if(n%2)a*a+b*b;if(!n%2)a*(a+2*b)' | bc`

Diff your entire server config at ScriptRock.com

]]>Calculates nth Fibonacci number for all n>=0, (much faster than matrix power algorithm from http://everything2.com/title/Compute+Fibonacci+numbers+FAST%2521 )

n=70332 is the biggest value at http://bigprimes.net/archive/fibonacci/ (corresponds to n=70331 there), this calculates it in less than a second, even on a netbook.

UPDATE: Now even faster! Uses recurrence relation for F(2n), see http://en.wikipedia.org/wiki/Fibonacci_number#Matrix_form

n is now adjusted to match Fn at wikipedia, so bigprimes.net table is offset by 1.

UPDATE2: Probably fastest possible now ;), uses a simple monoid operation:

uses monoid (a,b).(x,y)=(ax+bx+ay,ax+by) with identity (0,1), and recursion relations:

F(2n-1)=Fn*Fn+F(n-1)*F(n-1)

F(2n)=Fn*(2*F(n-1)+Fn)

then apply fast exponentiation to (1,0)^n = (Fn,F(n-1))

.

Note that: (1,0)^-1=(1,-1) so (a,b).(1,0) = (a+b,a) and (a,b)/(1,0)=(a,b).(1,0)^-1=(b,a-b)

So we can also use a NAF representation to do the exponentiation,http://en.wikipedia.org/wiki/Non-adjacent_form , it's also very fast (about the same, depends on n):

`time echo 'n=70332;m=(n+1)/2;a=0;b=1;i=0;while(m>0){z=0;if(m%2)z=2-(m%4);m=(m-z)/2;e[i++]=z};while(i--){c=a*a;a=c+2*a*b;b=c+b*b;if(e[i]>0){t=a;a+=b;b=t};if(e[i]<0){t=a;a=b;b=t-b}};if(n%2)a*a+b*b;if(!n%2)a*(a+2*b)' | bc`

Diff your entire server config at ScriptRock.com

]]>