Script

Filter
2010-04-20

God Mode i Win 7

Windows
Hur du får en genväg till alla inställningar
Skapa en mapp med namnet
GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
2010-03-03

Default ny sida 2

Html
Strikt xhtml med css
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="Rosiro" />
<meta name="generator" content="www.rosiro.se" />
<meta name="robots" content="noarchive" />
<meta name="Copyright" content="&copy; Rosiro" />
<script type="text/javascript" src="js/general.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" />
<style type="text/css"><!--
body {
    margin: 0;
    padding: 0;
    background: #fff;
    color: #333;
    font: 80%/120% Verdana, Geneva, Arial, Helvetica, sans-serif;
}
a { text-decoration: none; }
a:active { color: #f00; }
a:link { color: #333; }
a:visited { color: #666; }
a:hover { color: #06f; }
#wrap {

}
#content {

}
--></style>
</head>
<body><div id="wrap">

<div id="content"></div>

</div></body>
</html> 
2010-02-27

Öppna som admin i Vista

Windows
Lägger till en contextmeny som gör att du kan öppna något sdom admin
; // Spara som CmdHereAsAdmin.inf, högerklicka och välj installera
; //
; //***************************************************************************
; // ***** Script Header *****
; //
; // "CMD Prompt Here as Administrator" PowerToy for Windows Vista
; //
; // File:      CmdHereAsAdmin.inf
; //
; // Purpose:   To add a "CMD Prompt Here as Administrator" entry to the 
; //            Explorer context menu for Windows Vista
; //
; // Version:   1.0.1
; // Date :     01/18/2007
; //
; // History:
; // 1.0.0   01/15/2006  Created initial version.
; // 1.0.1   01/18/2007  Add /d switch to cd command.  Added header.
; //
; // ***** End Header *****
; //***************************************************************************

[version]
signature="$CHICAGO$"

[CmdHereAsAdminInstall]
CopyFiles = CmdHereAsAdmin.Files.Inf
AddReg    = CmdHereAsAdmin.AddReg

[DefaultInstall]
CopyFiles = CmdHereAsAdmin.Files.Inf
AddReg    = CmdHereAsAdmin.AddReg

[DefaultUnInstall]
DelFiles  = CmdHereAsAdmin.Files.Inf
DelReg    = CmdHereAsAdmin.DelReg

[SourceDisksNames]
55="CMD Prompt Here as Administrator","",1

[SourceDisksFiles]
CmdHereAsAdmin.INF=55

[DestinationDirs]
CmdHereAsAdmin.Files.Inf = 17

[CmdHereAsAdmin.Files.Inf]
CmdHereAsAdmin.INF

[CmdHereAsAdmin.AddReg]
HKLM,%UDHERE%,DisplayName,,"%CmdHereAsAdminName%"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %\CmdHereAsAdmin.inf"
HKCR,Directory\Shell\runas,,,"%CmdHereAsAdminAccel%"
HKCR,Directory\Shell\runas\command,,,"%\cmd.exe /k cd /d ""%1"""
HKCR,Drive\Shell\runas,,,"%CmdHereAsAdminAccel%"
HKCR,Drive\Shell\runas\command,,,"%\cmd.exe /k cd /d ""%1"""

[CmdHereAsAdmin.DelReg]
HKLM,%UDHERE%
HKCR,Directory\Shell\runas
HKCR,Drive\Shell\runas


[Strings]
CmdHereAsAdminName="CMD Prompt Here as Administrator PowerToy (Uninstall only)"
CmdHereAsAdminAccel="CMD Prompt Here as Administrator"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\CmdHereAsAdmin"
2009-11-09

Jämför innehållet i kataloger

Linux
Visar jämförelse mellan innehållet i två mappar
diff -rq /home/ /mnt/backup/home/
2009-10-28

Simple mail validated

Php
A simple class for sending mail - emailvalidated
<?php
class SimpleMail {

    private $to, $cc, $bcc, $from, $subject;
    private $send_text; // bool
    private $text_body;
    private $send_html; // bool
    private $html_body;

    private function is_email($email) {
        return preg_match("/^([a-z0-9])+([a-z0-9\._-])*@([a-z0-9\._-])+([a-z0-9_-])+[\.]([a-z]){2,4}$/i" , $email);
    }

    public function __construct() {
        $this->to = '';
        $this->cc = '';
        $this->bcc = '';
        $this->from = '';
        $this->subject = '';
        $this->send_text = true;
        $this->text_body = '';
        $this->send_html = false;
        $this->html_body = '';
    }

    public function setTo($value) {
        $aTo = explode(',', $value);
        $aToValidated = array();
        foreach ($aTo as $to) {
            if ($this->is_email($to)) {
                array_push($aToValidated, $to);
            }
        }
        $this->to = implode(',', $aToValidated);
    }
    public function setCc($value) {
        $aCc = explode(',', $value);
        $aCcValidated = array();
        foreach ($aCc as $cc) {
            if ($this->is_email($cc)) {
                array_push($aCcValidated, $cc);
            }
        }
        $this->cc = implode(',', $aCcValidated);
    }
    public function setBcc($value) {
        $aBcc = explode(',', $value);
        $aBccValidated = array();
        foreach ($aBcc as $bcc) {
            if ($this->is_email($bcc)) {
                array_push($aBccValidated, $bcc);
            }
        }
        $this->bcc = implode(',', $aBccValidated);
    }
    public function setFrom($value) {
        if ($this->is_email($value)) {
            $this->from = $value;
        }
    }
    public function setSubject($value) {
        $this->subject = $value;
    }
    
    public function setSend_text($value) {
        $this->send_text = $value; // bool
    }
    public function setText_body($value) {
        $this->send_text = true;
        $this->text_body = $value;
    }
    public function setSend_html($value) {
        $this->send_html = $value; // bool
    }
    public function setHtml_body($value) {
        $this->send_html = true;
        $this->html_body = $value;
    }

    public function send($to = null, $subject = null, $message = null, $headers = null) {
        $success = false;
        if (!is_null($to) && !is_null($subject) && !is_null($message)) {
            // Quick message...
            if ($this->is_email($to)) {
                $success = mail($to, $subject, $message, $headers);
            }
            return $success;
        } else {
            $headers = array();
            if (!empty($this->from)) { $headers[] = 'From: ' . $this->from; }
            if (!empty($this->cc))   { $headers[] = 'CC: ' . $this->cc; }
            if (!empty($this->bcc))  { $headers[] = 'BCC: ' . $this->bcc; }
            if ($this->send_text && !$this->send_html) {
                // Only text message...
                $message = $this->text_body;
            } else if (!$this->sendText && $this->sendHTML) {
                // Only html message...
                $headers[] = 'MIME-Version: 1.0';
                $headers[] = 'Content-type: text/html; charset="iso-8859-1"';
                $headers[] = 'Content-Transfer-Encoding: 7bit';
                $message = $this->html_body;
            } else if ($this->send_text && $this->send_html) {
                // Both text and html message...
                $boundary = '==MP_Bound_xyccr948x==';
                
                $headers[] = 'MIME-Version: 1.0';
                $headers[] = 'Content-type: multipart/alternative; boundary="' . $boundary . '"';
                
                $message = 'This is a Multipart Message in MIME format.' . "\n" .
                '--' . $boundary . "\n" .
                'Content-type: text/plain; charset="iso-8859-1"' . "\n" .
                'Content-Transfer-Encoding: 7bit' . "\n" .
                "\n" .
                $this->text_body . "\n" .
                '--' . $boundary . "\n" .
                'Content-type: text/html; charset="iso-8859-1"' . "\n" .
                'Content-Transfer-Encoding: 7bit' . "\n\n" .
                $this->html_body . "\n" .
                '--' . $boundary . '--';
            }
            
            $success = mail($this->to, $this->subject, $message, implode("\r\n", $headers));
            return $success;
        }
    }
}
?> 
🙂