Tag Archive for Shell

Shell coloring

export PS1='[ 33[01;31m]u[ 33[01;33m]@[ 33[01;36m]h [ 33[01;33m]w [ 33[01;35m]$ [ 33[00m]'
export LS_OPTIONS="--human --color=always"

source

AS3 Banner Template

package {

	import flash.events.*;
    import flash.display.*;
    import flash.net.*;
    import flash.utils.*;
	import flash.text.*;
    //import flash.media.Sound;
    //import flash.media.SoundChannel;
    //import flash.media.SoundTransform;
    //import flash.media.SoundMixer;

    import flash.filters.GlowFilter;
	import flash.filters.BlurFilter;

    //import com.MRM.*;

    import caurina.transitions.*;
    import caurina.transitions.properties.*;
    CurveModifiers.init();
	
	public class banner extends MovieClip {

		var dropWidth:Number = 3; // This will put this many pixels between the frame and the MASK/DROPSHADOW elements.
		//var loops:Number = 0; // do not change
		//var loopsMax:Number = 1; // how many times animation will loop
		//var loopDelay:Number = 2000; // time to delay before looping, set in milliseconds

        var glowIn:GlowFilter=new GlowFilter(0xFFFFFF,0.75,20,20,2,2);
        var glowOut:GlowFilter=new GlowFilter(0xFFFFFF,0,10,10,2,2);
		var blurIn:BlurFilter = new BlurFilter(2.0, 2.0, 1)
		var blurOut:BlurFilter = new BlurFilter(0.0, 0.0, 1)

		// animation function variables
		var pauseHere:Number; // change on each frame; determines how long you want to wait at any particular frame.
		var gap:Number; // a delay in between each step of an animation on each frame.
		
		var bumpSpeed:Number = .25;
		var spinSpeed:Number = .25;
		var moveSpeed:Number = .25;
		var FADESPEED:Number = .5;
		var BLURSPEED:Number = .5;
		var BUMPSIZE:Number = 1.25;


		public function banner() {
            //init
            ColorShortcuts.init();
            FilterShortcuts.init();
			
			// draw a border
			var myBorder:Shape = new Shape();
			myBorder.graphics.lineStyle(1,0x00000000);
			//myBorder.graphics.beginFill(0xff00ff00);
			myBorder.graphics.drawRect(0+dropWidth, 0+dropWidth, stage.stageWidth-(2*dropWidth), stage.stageHeight-(2*dropWidth));
			myBorder.graphics.endFill();
			addChild(myBorder);

			// size the dropshadow
			solid_mc.x = 0 + dropWidth;
			solid_mc.y = 0 + dropWidth;
			solid_mc.width = stage.stageWidth - 2*dropWidth;
			solid_mc.height = stage.stageHeight - 2*dropWidth;
			
			// size the mask
			mask_mc.x = 0 + dropWidth;
			mask_mc.y = 0 + dropWidth;
			mask_mc.width = stage.stageWidth - 2*dropWidth;
			mask_mc.height = stage.stageHeight - 2*dropWidth;
			
			// set button actions
			cta_invis_mc.buttonMode = true;
			cta_invis_mc.addEventListener(MouseEvent.MOUSE_DOWN,clickItem);
			cta_invis_mc.x = 0;
			cta_invis_mc.y = 0;
			cta_invis_mc.width = stage.stageWidth;
			cta_invis_mc.height = stage.stageHeight;
			
			makeButton(cta_manual_mc, overItem, outItem, clickItem);
			makeButton(cta_centering_mc, overItem, outItem, clickItem); cta_centering_mc.setText("DYNAMIC TEXT");
			
		}
		
		
		
		
		
		
		
		
		// GENERAL BUTTON OVER/OUT/CLICK FUNCTIONS
		
		private function makeButton(which_mc:MovieClip, overFunction:Function, outFunction:Function, clickFunction:Function):void {
			which_mc.buttonMode = true; 
			which_mc.useHandCursor = true;
			which_mc.mouseChildren = false;
			which_mc.addEventListener(MouseEvent.MOUSE_OVER, overFunction);
			which_mc.addEventListener(MouseEvent.MOUSE_OUT, outFunction);
			which_mc.addEventListener(MouseEvent.CLICK, clickFunction);
		}
		
        private function overItem(e:Event) {
            Tweener.addTween(e.currentTarget, {_filter:glowIn, scaleX:1.05, scaleY:1.05, time:0.2});
            //e.currentTarget.gotoAndStop(2);
//          switch (e.currentTarget.name) {
//              case "mc_dock_beef" :
//              break;
//          }
        }

        private function outItem(e:Event) {
            Tweener.addTween(e.currentTarget, {_filter:glowOut, scaleX:1, scaleY:1, time:0.2});
            //e.currentTarget.gotoAndStop(1);
        }


        private function clickItem(e:Event) {
			trace(e.currentTarget.name);
//            switch (e.currentTarget.name) {
//                case "tv01_mc" :
//                break;
//			}
		}












		// ANIMATION (CUSTOMIZED TWEENER) FUNCTIONS


		// init hides a movieclip and sets its alpha property to 0. This is useful for entering a new frame where the elements need to animate in.
		private function init(which_mc):void {
			which_mc.alpha = 0;
			which_mc.visible = false;
		}

		// fades a movieclip in or out.
		// syntax: fade(mymovieclip_mc, "out", .5, -1);
		private function fade(which_mc:MovieClip, method:String, myDelay:Number, newSpeed:Number):void {
			var thisSpeed:Number;
			if (newSpeed >= 0) thisSpeed = newSpeed; else thisSpeed = FADESPEED;
			
			switch(method)
			{
				case "in" :
				Tweener.addTween(which_mc, {alpha:100, time:thisSpeed, yDelay});
				which_mc.visible = true;
				break;
				case "out" :
				Tweener.addTween(which_mc, {alpha:0, time:thisSpeed, yDelay, onComplete:function() { which_mc.visible = false; } });				
				break;
			}
		}		
		
		// bump increases a movieclip's scale temporarily then returns it to normal
		// syntax: bump(mymovieclip_mc, 0, -1);
		private function bump(which_mc:MovieClip, myDelay:Number, factor:Number):void {
			var baseScale:Number = which_mc.scaleX;
			if (factor < 1) factor = 1;
			Tweener.addTween(which_mc, {scaleX:BUMPSIZE * baseScale * factor, scaleY:BUMPSIZE * baseScale * factor, time:bumpSpeed, yDelay});
			Tweener.addTween(which_mc, {scaleX:baseScale-(BUMPSIZE*baseScale*.1), scaleY:baseScale-(BUMPSIZE*baseScale*.1), time:bumpSpeed, yDelay + bumpSpeed});
			Tweener.addTween(which_mc, {scaleX:baseScale, scaleY:baseScale, time:bumpSpeed, yDelay + (bumpSpeed*2), transition:"easeInOutQuad" });
		}
		
		// blurs a movieclip in or out.
		// syntax: blur(mymovieclip_mc, "out", .5, -1);
		private function blur(which_mc:MovieClip, method:String, myDelay:Number, newSpeed:Number):void {
			var thisSpeed:Number;
			if (newSpeed >= 0) thisSpeed = newSpeed; else thisSpeed = BLURSPEED;
			
			switch(method)
			{
				case "in" :
				Tweener.addTween(which_mc, {_filter:blurIn, time:thisSpeed, yDelay});
				break;
				case "out" :
				Tweener.addTween(which_mc, {_filter:blurOut, time:thisSpeed, yDelay});
				break;
			}
		}





	}
}

source

using sendEmail perl script and Gmail SMTP server to send email

./sendEmail -f <a href="mailto:fromadd@site.com">fromadd@site.com</a> -t <a href="mailto:toadd@site.com">toadd@site.com</a> -u "Testing sendEmail script" -m "it works" -s smtp.gmail.com -xu gmailUsername -xp gmailPassword

source

Print Date/Time in DOS Batch File

set DATESTAMP=%DATE:~10,4%_%DATE:~4,2%_%DATE:~7,2%

set TIMESTAMP=%TIME:~0,2%_%TIME:~3,2%_%TIME:~6,2%

set DATEANDTIME=%DATESTAMP%_%TIMESTAMP%



echo Today's date is %DATESTAMP%

echo The local time is %TIMESTAMP%

echo Date and time: %DATEANDTIME%

source

Fork a process with PHP

function fork($cmd){
$cmd = $cmd.' > /dev/null &';
shell_exec($cmd);
}

source

AS2 Banner with ClickTag Template

// see the source files found in the zip in the URL above.
// Thanks to Nate63179 for the idea of ClickTag URL rollover
// <a href="http://snipplr.com/view/14239/actionscript-20-click-tag-handler/

" >http://snipplr.com/view/14239/actionscript-20-click-tag-handler/
source

Add readline editing and history capability to commandline interfaces

function rline ()
{
socat READLINE EXEC:"$*",pty
}

# Usage example:
rline ncftp -u anonymous <a href="http://ftp.kernel.org

" >ftp.kernel.org
source

Remame files to lowercase in Linux

rename 'y/A-Z/a-z/' *

source

Grep for files that do not match a pattern

grep -L "the pattern" *

# to recurse into subdirectories

grep -RL "the pattern" *

source

comparing the checksums of two files with Perl and cksum

cksum file1 file2 | perl -ane '$x ||= $F[0]; warn if $x != $F[0]'

# This can be shortened slightly, to:

cksum file1 file2 | perl -ane 'warn if $F[0] != ($x ||= $F[0])'

# If the checksum value we need to match is already known, that can be
# shortened to:

cksum file1 file2 | perl -ane 'warn if "664253628" != $F[0]'

# on Mac, if you have copied a checksum value into the clipboard, use
# pbpaste to do the comparison

cksum file1 file2 | perl -ane 'warn if `pbpaste` != $F[0]'

source