Sunday, October 26, 2014

Saturday, October 25, 2014

Friday, October 24, 2014

Create trigger, Free disk space is less than n GB, zabbix


For 5GB trigger copy to the title
Free disk space is less than 5GB on volume {#FSNAME} ({ITEM.VALUE2})
Copy to the Expression
{Template OS Windows:vfs.fs.size[{#FSNAME},free].last(0)}<5400000000 and {Template OS Windows:vfs.fs.size[{#FSNAME},free].last(0)}>2148000000 and {Template OS Windows:vfs.fs.size[{#FSNAME},free].last(0)}

For 2GB trigger copy to the title
Free disk space is less than 2GB on volume {#FSNAME} ({ITEM.VALUE2})
Copy to the Expression
{Template OS Windows:vfs.fs.size[{#FSNAME},free].last(0)}<2148000000 and {Template OS Windows:vfs.fs.size[{#FSNAME},free].last(0)}

Best practice to periodically update flash player, GP

1) Share a network destination with write permissions for system acount and also allow "Domain Computers" collection to write to this destination. This will be the destination where log files are created.
\\status\log\AdobeFlashPlayer
2) Get the latest adobe flash player installers. These links always stands for latest version
http://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player_ax.exe
http://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player.exe
I gues it is good to have only one place where you keep latest flash player installer. Let it be your public install server:
\\public\install\AdobeFlashPlayer
3) Create installer script. This will update flash player only for Windows XP and Windows 7
install-flash-player.cmd:
@echo off
set m=HKLM\SOFTWARE\Macromedia
set l=\\status\log\AdobeFlashPlayer
setlocal EnableDelayedExpansion
if not exist "%l%\%computername%.log" (
ver | find "Version 6.1" > nul 2>&1
if !errorlevel!==0 (
echo Windows 7 detected
goto win7
)
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" ^
/v ProductName | find "Windows XP" > nul 2>&1
if !errorlevel!==0 (
echo Windows XP detected
goto winxp
)
goto exit

:winxp
:win7
echo %date% %time%
echo installing plash player for internet explorer
start /wait "" "%~dp0install_flash_player_ax.exe" -install
reg query %m%\FlashPlayerActiveX /v Version | find "Version" > "%l%\%computername%.log"
echo installing plash player for firefox, opera, etc
start /wait "" "%~dp0install_flash_player.exe" -install
reg query %m%\FlashPlayerPlugin /v Version | find "Version" >> "%l%\%computername%.log"
)

:exit

echo.
endlocal
4) Create a computer startup script for "Domain Computers" collection and re-call the flash player installer
call "\\public\install\AdobeFlashPlayer\install-flash-player.cmd"
Everty time the new flash player comes out you must only overwrite install_flash_player_ax.exe and install_flash_player.exe in a public installation directory and delete all log files.

If want to automatize also this process you can create schedulled task. In this script you need wget and md5sum
refresh-latest-version.cmd:
@echo off
set l=\\status\log\AdobeFlashPlayer
setlocal EnableDelayedExpansion
"%~dp0wget.exe" http://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player_ax.exe -O%~dp0install_flash_player_ax.exe.new
"%~dp0wget.exe" http://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player.exe -O%~dp0install_flash_player.exe.new
for /f "tokens=1" %%a in ('%~dp0md5sum.exe %~dp0install_flash_player.exe.new') do (
%~dp0md5sum.exe %~dp0install_flash_player.exe | findstr %%a
if not !errorlevel!==0 (
xcopy %~dp0install_flash_player.exe.new %~dp0install_flash_player.exe /Y
)
del %~dp0install_flash_player.exe.new /F /Q
)
for /f "tokens=1" %%a in ('%~dp0md5sum.exe %~dp0install_flash_player_ax.exe.new') do (
%~dp0md5sum.exe %~dp0install_flash_player_ax.exe | findstr %%a
if not !errorlevel!==0 (
xcopy %~dp0install_flash_player_ax.exe.new %~dp0install_flash_player_ax.exe /Y
del %l%\*.* /Q /F
)
del %~dp0install_flash_player_ax.exe.new /F /Q
)
endlocal
del %l%\*.* /Q /F is only set once in ActiveX version of flash player so the detection rule at the end depends only if this version is changed.

Everytime you run refresh-latest-version.cmd it downloads version of flash player which today is the latest. Then it compares old installer with current and if it is not the same then overwrite the installer.

Wednesday, October 22, 2014

My favourite pointers challenge


int a=3, b=4, c=5;
int* pa=&a, *pb=&b, *pc=&c;
Pointer pa points at box a. &a is just an address in memory.
Pointer pb points at box b. Pointer pc points at box c.

First assigmed happens with a
a=b*c;
This is just basic algebra

Second assigment is taught one
a*=c;
This has nothing to do with pointers. It is just and syntax niche lika a+=2 or a-=7
At the end this only means a=a*c

Get the real value
b=*pa;
A$$hole * means that the pointer needs the real value of box. It can be easy be mismatched with pointer address.

Now we talk about addreses. What is the address where the pointers is aiming at?
pc=pa;
So if the pointer pa are aiming on duck then tha pointer pc now pointing too.

Pointer pb point at one box and thet box needs to recieve new value
*pb=b*c;

The value of c box depends on boxes where the pointer pa and pc aims
c=(*pa)*(*pc)
The box value where pointer pc aims depends on a multiplication with box where pb aiming at
*pc=a*(*pb);
http://youtu.be/xFxE68JE1T0?t=48m1s

Monday, October 20, 2014

autounattend.xml, Windows Technical Preview for Enterprise, x64

For 32-bit verison use:
autounattend.xml, Windows Technical Preview for Enterprise, x86

This is tested and work for
http://care.dlservice.microsoft.com/dl/download/F/5/7/F574727C-B145-4A7D-B85B-11C4E8DC894B/9841.0.140912-1613.FBL_RELEASE_CLIENTENTERPRISE_VOL_X64FRE_EN-US.ISO
fd2f1839e58aa5af3e85a00025de8e8c
248a7dac2ee2d39597e1f95fe1e8e06b49092cb5

This autounattend.xml is pretty cool to use in VirtualBox environment
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <servicing></servicing>
    <settings pass="windowsPE">
        <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <DiskConfiguration>
                <Disk wcm:action="add">
                    <CreatePartitions>
                        <CreatePartition wcm:action="add">
                            <Order>1</Order>
                            <Type>Primary</Type>
                            <Size>24576</Size>
                        </CreatePartition>
                    </CreatePartitions>
                    <ModifyPartitions>
                        <ModifyPartition wcm:action="add">
                            <Extend>false</Extend>
                            <Format>NTFS</Format>
                            <Letter>C</Letter>
                            <Order>1</Order>
                            <PartitionID>1</PartitionID>
                            <Label>Windows 10</Label>
                        </ModifyPartition>
                    </ModifyPartitions>
                    <DiskID>0</DiskID>
                    <WillWipeDisk>true</WillWipeDisk>
                </Disk>
                <WillShowUI>OnError</WillShowUI>
            </DiskConfiguration>
            <UserData>
              <!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx -->
                <ProductKey>PBHCJ-Q2NYD-2PX34-T2TD6-233PK
                    <WillShowUI>Never</WillShowUI>
                </ProductKey>

                <AcceptEula>true</AcceptEula>
                <FullName>Full Name</FullName>
                <Organization>Organization</Organization>
            </UserData>
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>1</PartitionID>
                    </InstallTo>
                    <WillShowUI>OnError</WillShowUI>
                    <InstallToAvailablePartition>false</InstallToAvailablePartition>
                    <InstallFrom>
                        <MetaData wcm:action="add">
                            <Key>/IMAGE/NAME</Key>
                            <Value>Windows Technical Preview for Enterprise</Value>
                        </MetaData>
                    </InstallFrom>
                </OSImage>
            </ImageInstall>
        </component>

        <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <SetupUILanguage>
                <UILanguage>en-US</UILanguage>
            </SetupUILanguage>
            <InputLocale>en-US</InputLocale>
            <SystemLocale>en-US</SystemLocale>
            <UILanguage>en-US</UILanguage>
            <UILanguageFallback>en-US</UILanguageFallback>
            <UserLocale>en-US</UserLocale>
        </component>
    </settings>

    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <UserAccounts>
                <AdministratorPassword>
                    <Value></Value>
                    <PlainText>true</PlainText>
                </AdministratorPassword>
    <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value>catonrug</Value>
                            <PlainText>true</PlainText>
                        </Password>
                        <Description>catonrug user</Description>
                        <DisplayName>catonrug</DisplayName>
                        <Group>administrators</Group>
                        <Name>catonrug</Name>
     </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
                <NetworkLocation>Work</NetworkLocation>
                <ProtectYourPC>1</ProtectYourPC>
                <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
                <HideLocalAccountScreen>true</HideLocalAccountScreen>
                <SkipUserOOBE>true</SkipUserOOBE>
                <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
            </OOBE>
            <AutoLogon>
                <Password>
                    <Value></Value>
                    <PlainText>true</PlainText>
                </Password>
                <Username>administrator</Username>
                <Enabled>true</Enabled>
            </AutoLogon>
            <ShowWindowsLive>false</ShowWindowsLive>
        </component>
    </settings>
    <settings pass="specialize">
   <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" >
                            <OEMInformation>
                <HelpCustomized>false</HelpCustomized>
            </OEMInformation>                        
            <ComputerName />
            <TimeZone>Pacific Standard Time</TimeZone>
            <RegisteredOwner></RegisteredOwner>
 </component>
        <component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <SkipAutoActivation>true</SkipAutoActivation>
        </component>
    </settings>
</unattend>

Windows 10: Technical Preview for Enterprise

9841.0.140912-1613.FBL_RELEASE_CLIENTENTERPRISE_VOL_X64FRE_EN-US.ISO
http://care.dlservice.microsoft.com/dl/download/F/5/7/F574727C-B145-4A7D-B85B-11C4E8DC894B/9841.0.140912-1613.FBL_RELEASE_CLIENTENTERPRISE_VOL_X64FRE_EN-US.ISO
https://drive.google.com/file/d/0B4HLOR0vqZwMNlA2bTZBakwzVkE
fd2f1839e58aa5af3e85a00025de8e8c
248a7dac2ee2d39597e1f95fe1e8e06b49092cb5

9841.0.140912-1613.FBL_RELEASE_CLIENTENTERPRISE_VOL_X86FRE_EN-US.ISO
http://care.dlservice.microsoft.com/dl/download/F/5/7/F574727C-B145-4A7D-B85B-11C4E8DC894B/9841.0.140912-1613.FBL_RELEASE_CLIENTENTERPRISE_VOL_X86FRE_EN-US.ISO
https://drive.google.com/file/d/0B4HLOR0vqZwMQ0ZrRWNHeExJQjA
e0dd1b7c087b3495074e0fd4a6eb4afe
bf225e38826ae2196bcb33cb194904081c987dd4

Technical Preview for Enterprise:
PBHCJ-Q2NYD-2PX34-T2TD6-233PK

Other related files:
en_windows_10_technical_preview_for_enterprise_x64_dvd_5554079.iso
9ffd8906537ed96abef64458d9ed48f1
c79e60ae272adf7455fae3d923a6d06e8d06a935

en_windows_10_technical_preview_for_enterprise_x86_dvd_5554091.iso
9d3be1ab7342e80e170c5024e6e36dc7
968debe05779871e7ee71d43589e9369434cc03f

Sunday, October 19, 2014

Friday, October 17, 2014

Sync clock under linux with ntp server

Make sure the ntp package is installed

On debian run
sudo apt-get install ntp
On CentOS, Red Hat run
yum install ntp
Create scheduled synchronization
sudo sh
echo '#!/bin/sh' > /etc/cron.daily/synctime
echo 'ntpdate -u ntp.catonrug.net > /dev/null 2>&1' >> /etc/cron.daily/synctime
chmod 755 /etc/cron.daily/synctime
exit
Sync now
ntpdate -u ntp.catonrug.net > /dev/null 2>&1
Restart cron
/etc/init.d/cron restart
Source:
http://www.howtogeek.com/tips/how-to-sync-your-linux-server-time-with-network-time-servers-ntp/

Tuesday, October 14, 2014

Physical restart Sony Xperia Z1

To restart the device you must shut it down first.
This can be done by opening the slot where SIM card is having a good time.

Use something very thin like pencil or toothpick and hold down the off button for three seconds ;)

Sunday, October 12, 2014

Friday, October 10, 2014

Output content from log file into zabbix dashboard, regexp example

On the client side create item that looks for specific condition in log file
UserParameter=custom_item,if exist c:\pat\to\output.log cat c:\pat\to\output.log | grep -e "content.*found" | tail -1
To use the last value use tail -1.
To use first value use head -1.

Into zabbix server create item custom_item with text value

Create trigger name
Details from log file {ITEM.LASTVALUE}
Formula
{servername:custom_item.regexp(content)}=1
Do not use quotes inside regex()!
If the log file meets defined condition it will be reported into zabbix dashboard :)

ITEM.LASTVALUE is truncated to 20 characters

1) In zabbix server search for items.inc.php
find / -name *items.inc.php
open file
vi /var/www/html/include/items.inc.php
type / for search and write zbx_strlen or mb_strlen

        // apply value mapping
        switch ($item['value_type']) {
                case ITEM_VALUE_TYPE_STR:
                        $mapping = getMappedValue($value, $item['valuemapid']);
                // break; is not missing here
                case ITEM_VALUE_TYPE_TEXT:
                case ITEM_VALUE_TYPE_LOG:
                        if ($trim && zbx_strlen($value) > 20) {
                                $value = zbx_substr($value, 0, 20).'...';
                        }

                        if ($mapping !== false) {
                                $value = $mapping.' ('.$value.')';
                        }
                        break;
                default:
                        $value = applyValueMap($value, $item['valuemapid']);
        }

        return $value;
Replace with something bigger
        // apply value mapping
        switch ($item['value_type']) {
                case ITEM_VALUE_TYPE_STR:
                        $mapping = getMappedValue($value, $item['valuemapid']);
                // break; is not missing here
                case ITEM_VALUE_TYPE_TEXT:
                case ITEM_VALUE_TYPE_LOG:
                        if ($trim && zbx_strlen($value) > 20) {
                                $value = zbx_substr($value, 0, 40).'...';
                        }

                        if ($mapping !== false) {
                                $value = $mapping.' ('.$value.')';
                        }
                        break;
                default:
                        $value = applyValueMap($value, $item['valuemapid']);
        }

        return $value;
Save file with :wq

Restart zabbix server
service zabbix_server restart
Source:
https://support.zabbix.com/browse/ZBX-4303
http://www.howtogeek.com/112674/how-to-find-files-and-folders-in-linux-using-the-command-line/ https://www.zabbix.com/forum/showthread.php?t=12402

Monday, October 6, 2014

Windows 10 Tech Preview update for Windows 7

Update that allow to update Windows 7 to Windows Tech Preview:
http://web.esd.microsoft.com/W9TPE/0ABA00DD20413FB6425A0D45222C562B/E/WindowsTechnicalPreview.exe
ee6edfa3c36888435779b62113b83fc9
350a762f540cbc1aacec45d6503cb8086e637855

http://b1.download.windowsupdate.com/d/updt/2014/09/9841.0.140912-1613.fbl_release_clientpro_ret_x64fre_en-us_fbae6f1d1352afa2cea0999fb739b0fd25ad9836.esd
mirror: https://drive.google.com/file/d/0B7AntvDK0aoRWFJwcVJKRVlkTDA
aa62768e6c58f002d0e72f04121622e3
fbae6f1d1352afa2cea0999fb739b0fd25ad9836

http://b1.download.windowsupdate.com/d/updt/2014/09/9841.0.140912-1613.fbl_release_clientpro_ret_x86fre_en-us_1c434f9c827e488eebea244a3fdb24936a029f01.esd
mirror: https://drive.google.com/file/d/0B7AntvDK0aoRbWcyaDJXMDBvWGc
b4017e8727ce5506bc902a25b8e0ff71
1c434f9c827e488eebea244a3fdb24936a029f01

Related:
http://forums.mydigitallife.info/threads/53855-Windows-8-1-with-Update-ESDs-Repository/page56?p=957551

esd-decrypter-v3.7z
c88023cfc2530bd439310a9420a7351d
3dfe479541a167e8ca785c95ce09523fbc10671f

decrypt-with-CryptoKey.cmd
@echo off
title ESD DECRYPTION
color 1f
%windir%\system32\reg.exe query "HKU\S-1-5-19" >nul 2>&1 || (
echo      -------
echo  *** WARNING ***
echo      -------
echo.
echo.
echo ADMINISTRATOR PRIVILEGES NOT DETECTED
echo ____________________________________________________________________________
echo.
echo This script require administrator privileges.
echo.
echo To do so, 'Open Command Prompt as administrator' in the current directory.
echo.
echo or right click on Command Prompt and select 'Run as administrator'
echo then change location to the script directory.
echo.
echo Press any key to exit...
pause >nul
goto :eof
)
cd /d "%~dp0"
if exist "%CD%\dism\dism.exe" set Path=%CD%\dism;%Path%
SET ENCRYPTEDESD=
SET ERRORTEMP=
SET DECRYPTED=0

SET ENCRYPTEDESD=%~1
dism /get-wiminfo /wimfile:"%ENCRYPTEDESD%" >nul 2>&1 || (
echo.
echo Incorrect Usage or filename.
echo.
echo Usage:
echo decrypt filename.esd
echo.
echo Press any key to exit.
pause >nul
goto :eof
)

for /f "tokens=1* delims=: " %%i in ('dism /english /get-wiminfo /wimfile:%1 /index:4 ^| find /i "Name"') do set WINDOWSNAME="%%j"
IF %ERRORLEVEL% NEQ 0 (
ECHO There is a problem reading the index name.
echo.
echo Press any key to exit.
pause >nul
goto :eof
)

for /f "tokens=2 delims=: " %%i in ('dism /english /get-wiminfo /wimfile:%1 /index:4 ^| find /i "Architecture"') do set arch=%%i
IF %ERRORLEVEL% NEQ 0 (
ECHO There is a problem reading the index architecture.
echo.
echo Press any key to exit.
pause >nul
goto :eof
)

for /f "tokens=2 delims=: " %%i in ('dism /english /get-wiminfo /wimfile:%1 /index:4 ^| find /i "Edition"') do set editionid=%%i
IF %ERRORLEVEL% NEQ 0 (
ECHO There is a problem reading the index edition id.
echo.
echo Press any key to exit.
pause >nul
goto :eof
)

for /f "tokens=1" %%i in ('dism /english /get-wiminfo /wimfile:%1 /index:4 ^| find /i "Default"') do set langid=%%i
IF %ERRORLEVEL% NEQ 0 (
ECHO There is a problem reading the index language id.
echo.
echo Press any key to exit.
pause >nul
goto :eof
)

if "%arch%"=="x86" set arch=X86
if "%arch%"=="x64" set arch=X64
set DVDLABEL=IR3_CCSA_%arch%FRER_%langid%_DV9
if "%editionid%"=="CoreSingleLanguage" set DVDLABEL=IR3_CSLA_%arch%FRER_%langid%_DV9
if "%editionid%"=="ProfessionalWMC" set DVDLABEL=IR3_CPWMCA_%arch%FRER_%langid%_DV9
if "%editionid%"=="CoreCountrySpecific" set DVDLABEL=IR3_CCHA_%arch%FRER_%langid%_DV9
if "%editionid%"=="Core" set DVDLABEL=IR3_CCOA_%arch%FRER_%langid%_DV9
if "%editionid%"=="CoreN" set DVDLABEL=IR3_CCNA_%arch%FRER_%langid%_DV9
if "%editionid%"=="Professional" set DVDLABEL=IR3_CPRA_%arch%FRER_%langid%_DV9
if "%editionid%"=="ProfessionalN" set DVDLABEL=IR3_CPRNA_%arch%FRER_%langid%_DV9

:MAINMENU
cls
ECHO ===============================================================================
ECHO.                          ESD DECRYPTION SCRIPT
ECHO ===============================================================================
ECHO.                   1 - Decrypt and export to install.esd
ECHO.                   2 - Decrypt and create install.wim
ECHO.                   3 - Create Full ISO with install.esd
ECHO.                   4 - Create Full ISO with install.wim
ECHO ===============================================================================
ECHO.                            Press 'Q' to Quit
ECHO ===============================================================================

choice /c 1234q /n /m "Choose a menu option, or Q to quit: "
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP%==1 GOTO :Selection1
IF %ERRORTEMP%==2 GOTO :Selection2
IF %ERRORTEMP%==3 GOTO :Selection3
IF %ERRORTEMP%==4 GOTO :Selection4
IF %ERRORTEMP%==5 GOTO :QUIT
GOTO :MAINMENU

:Selection1
cls
IF EXIST "%CD%\install.esd" (
ECHO ===============================================================================
ECHO.  An install.esd file is already present in the current folder.
ECHO ===============================================================================
ECHO.
echo Press any key to exit.
pause >nul
GOTO :QUIT
)
Echo.
CALL :DECRYPT
ECHO ===============================================================================
Echo Exporting ESD Index 4 to a new install.esd file...
ECHO ===============================================================================
dism /export-image /sourceimagefile:"%ENCRYPTEDESD%" /Sourceindex:4 /destinationimagefile:install.esd /compress:recovery /checkintegrity
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism export.)
echo.
echo Press any key to exit.
pause >nul
GOTO :QUIT

:Selection2
cls
IF EXIST "%CD%\install.wim" (
ECHO ===============================================================================
ECHO.  An install.wim file is already present in the current folder.
ECHO ===============================================================================
ECHO.
echo Press any key to exit.
pause >nul
GOTO :QUIT
)
Echo.
CALL :DECRYPT
ECHO ===============================================================================
Echo Exporting ESD Index 4 to a a new install.wim file...
ECHO ===============================================================================
mkdir temp
dism /Quiet /Capture-Image /ImageFile:install.wim /CaptureDir:.\temp /Name:container /Compress:max /CheckIntegrity
rmdir /s /q temp
dism /Export-Image /SourceImageFile:"%ENCRYPTEDESD%" /SourceIndex:4 /DestinationImageFile:install.wim /compress:recovery /CheckIntegrity
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism export.&PAUSE&GOTO :QUIT)
dism /Quiet /Delete-Image /ImageFile:install.wim /Index:1 /CheckIntegrity
if "%editionid%"=="ProfessionalWMC" (
cd "%~dp0DISM\"
ECHO.
wimlib-imagex.exe update "%~dp0install.wim" 1 --check < wim-update.txt >nul
cd /d "%~dp0"
)
ECHO.
echo Press any key to exit.
pause >nul
GOTO :QUIT

:Selection3
cls
Echo.
CALL :DECRYPT
ECHO.
ECHO ===============================================================================
ECHO Creating ISO Structure Layout...
ECHO ===============================================================================
IF EXIST ISOFOLDER\ rmdir /s /q ISOFOLDER\
mkdir ISOFOLDER
dism /apply-image /imagefile:"%ENCRYPTEDESD%" /index:1 /applydir:ISOFOLDER\
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism apply.&PAUSE&GOTO :QUIT)
del ISOFOLDER\MediaMeta.xml
ECHO.
ECHO ===============================================================================
Echo Exporting ESD Index 2 to a new boot.wim file...
ECHO ===============================================================================
mkdir temp
dism /Quiet /Capture-Image /ImageFile:ISOFOLDER\sources\boot.wim /CaptureDir:.\temp /Name:container /Compress:max
rmdir /s /q temp
dism /Export-Image /SourceImageFile:"%ENCRYPTEDESD%" /SourceIndex:2 /DestinationImageFile:ISOFOLDER\sources\boot.wim /compress:recovery /Bootable
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism export.&PAUSE&GOTO :QUIT)
dism /Quiet /Delete-Image /ImageFile:ISOFOLDER\sources\boot.wim /Index:1
ECHO.
ECHO ===============================================================================
Echo Exporting ESD Index 3 to the boot.wim file...
ECHO ===============================================================================
dism /Export-Image /SourceImageFile:"%ENCRYPTEDESD%" /SourceIndex:3 /DestinationImageFile:ISOFOLDER\sources\boot.wim /compress:recovery /Bootable
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism export.&PAUSE&GOTO :QUIT)
ECHO.
ECHO ===============================================================================
Echo Exporting ESD Index 4 to a new install.esd file...
ECHO ===============================================================================
dism /export-image /sourceimagefile:"%ENCRYPTEDESD%" /Sourceindex:4 /destinationimagefile:ISOFOLDER\sources\install.esd /compress:recovery /checkintegrity
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism export.&PAUSE&GOTO :QUIT)
ECHO.
ECHO ===============================================================================
ECHO Creating ei.cfg file...
ECHO ===============================================================================
ECHO.
echo [EditionID] >ISOFOLDER\sources\EI.CFG
echo %editionid% >>ISOFOLDER\sources\EI.CFG
echo [Channel] >>ISOFOLDER\sources\EI.CFG
echo Retail >>ISOFOLDER\sources\EI.CFG
echo [VL] >>ISOFOLDER\sources\EI.CFG
echo 0 >>ISOFOLDER\sources\EI.CFG
ECHO.
ECHO ===============================================================================
ECHO Creating ISO file...
ECHO ===============================================================================
oscdimg.exe -bootdata:2#p0,e,b"ISOFOLDER\boot\etfsboot.com"#pEF,e,b"ISOFOLDER\efi\Microsoft\boot\efisys.bin" ^
-o -h -m -u2 -udfver102 ^
-t03/18/2014,09:09:28 -g ^
-l%DVDLABEL% ^
ISOFOLDER ^
%DVDLABEL%.iso
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during ISO creation.)
Echo.
echo Press any key to exit.
pause >nul
GOTO :QUIT

:Selection4
cls
Echo.
CALL :DECRYPT
ECHO.
ECHO ===============================================================================
ECHO Creating ISO Structure Layout...
ECHO ===============================================================================
IF EXIST ISOFOLDER\ rmdir /s /q ISOFOLDER\
mkdir ISOFOLDER
dism /apply-image /imagefile:"%ENCRYPTEDESD%" /index:1 /applydir:ISOFOLDER\
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism apply.&PAUSE&GOTO :QUIT)
del ISOFOLDER\MediaMeta.xml
ECHO.
ECHO ===============================================================================
Echo Exporting ESD Index 2 to a new boot.wim file...
ECHO ===============================================================================
mkdir temp
dism /Quiet /Capture-Image /ImageFile:ISOFOLDER\sources\boot.wim /CaptureDir:.\temp /Name:container /Compress:max
rmdir /s /q temp
dism /Export-Image /SourceImageFile:"%ENCRYPTEDESD%" /SourceIndex:2 /DestinationImageFile:ISOFOLDER\sources\boot.wim /compress:recovery /Bootable
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism export.&PAUSE&GOTO :QUIT)
dism /Quiet /Delete-Image /ImageFile:ISOFOLDER\sources\boot.wim /Index:1
ECHO.
ECHO ===============================================================================
Echo Exporting ESD Index 3 to the boot.wim file...
ECHO ===============================================================================
dism /Export-Image /SourceImageFile:"%ENCRYPTEDESD%" /SourceIndex:3 /DestinationImageFile:ISOFOLDER\sources\boot.wim /compress:recovery /Bootable
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism export.&PAUSE&GOTO :QUIT)
ECHO.
ECHO ===============================================================================
Echo Exporting ESD Index 4 to a a new install.wim file...
ECHO ===============================================================================
mkdir temp
dism /Quiet /Capture-Image /ImageFile:ISOFOLDER\sources\install.wim /CaptureDir:.\temp /Name:container /Compress:max /CheckIntegrity
rmdir /s /q temp
dism /Export-Image /SourceImageFile:"%ENCRYPTEDESD%" /SourceIndex:4 /DestinationImageFile:ISOFOLDER\sources\install.wim /compress:recovery /CheckIntegrity
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism export.&PAUSE&GOTO :QUIT)
dism /Quiet /Delete-Image /ImageFile:ISOFOLDER\sources\install.wim /Index:1 /CheckIntegrity
if "%editionid%"=="ProfessionalWMC" (
cd "%~dp0DISM\"
ECHO.
wimlib-imagex.exe update "%~dp0ISOFOLDER\sources\install.wim" 1 --check < wim-update.txt >nul
cd /d "%~dp0"
)
ECHO.
ECHO ===============================================================================
ECHO Creating ISO file...
ECHO ===============================================================================
oscdimg.exe -bootdata:2#p0,e,b"ISOFOLDER\boot\etfsboot.com"#pEF,e,b"ISOFOLDER\efi\Microsoft\boot\efisys.bin" ^
-o -h -m -u2 -udfver102 ^
-t03/18/2014,09:09:28 -g ^
-l%DVDLABEL% ^
ISOFOLDER ^
%DVDLABEL%.iso
SET ERRORTEMP=%ERRORLEVEL%
IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during ISO creation.)
Echo.
echo Press any key to exit.
pause >nul
GOTO :QUIT

:DECRYPT
IF DECRYPTED NEQ 1 (
if not exist %ENCRYPTEDESD%.bak (
Echo Backing up original esd file...
copy %ENCRYPTEDESD% %ENCRYPTEDESD%.bak >nul)
ECHO.
Echo Running Decryption program...
ECHO.
esddecrypt.exe %ENCRYPTEDESD% BwIAAACkAABSU0EyAAgAAAEAAQA5WQn9lTT4Ci679UcfZW6y8GkbeGTN9bKbgjnigtWmb7pPkifbr3ihmmtJ1ZWJmZCyDyeRNHwHDieOiM8zfgRJr575RKQI8yWi6wNAZVhUZDzKlch4BgABut2lcjZRT5o/Iyotd0tKW7Np1ur8D/HawdmHXdhN42hjg7PKNfvbgXICNNK+uschVzA39HWejEowO5ppaXBObLpN28Ipun3+s0xPNePHNVKD/4azFGd11ZZWmoh3NpnZXBGW3Jk2fn6hmrQ434Mrw4qdpIfTqh/d0aWGE7CseZPYR0F9Gd6DWyXn6JzkvPBPRNtdU7SK5Xeh+pDmTnme5av3c1XNBka2hScgqAT/BOAwaIvufA6QZXccHkeHnOVO/XHEi339OT0FJLNWearerYzfHtHh6D8+d7fIdHBsgMCMd/O2suhNVBWsipzA8UPnhy4+4uPAhoV7fqaYjPbE0fUTXT82SUG11W4tjs8+kTflzwX1qoNezfLdG6++h7LJSGJNPe2QfsQlB8NxLTReIHsyW5Fv5Q0LZH/Z5tJsOeu0P39z9k/oW30TGHIVnipOkdfA1PREFFwDWJ7MKsTQkW2ikSo9Y1HbUhIAb2xI9M28GAxGxdaPa69vAepfqiPOfEFOiZcUhVkLs6vv8GVOsLRMHFalKhwNi6bWX32R76OKmRHLPPl47dkHCBy/nBVSLaVyUo25gEX3pVgGDpoiHOTzeq1qvPdguBMXHtgvpvEMTBEMDFpp1hMqWkNcapPA25oGQmJr5LouRsfaHXe52LoJpniCA/Lf7cFSCbx+Wkh1bl/4uepz45bZGpjde4WvPnKPBOsi+EZ30lYi0mfKGBQ7HS6RE9iQSbOJYZ2djnY+ok8VkGrXU28l1kQParu3mnXOcQdviIJhtH6nor3GjXYbMml40/b3lGPn6qPjf0UW9glD2apdQMyTTxO2YzLlpiW96d5SwsPTDfP83YTZUZd6Er4cvmlb7G4qidlF7xIdVzzmGx5PPAuv6oLzMf3qFHKgo8nGC3ZcHfTsHz62eTvDFfCxuqTSbZYby+SraGvez3gZSKnbmvkfaBumgMPULGjsPC0FGMf1PXzxHQ3Y5chnpxYXF86h9NRRf9efeByhj3cS1AQGNidgIfo1l0CdNDtWegcZC/0U8+0O/lMGUnemt8a+Zl6jb+XHB9czxWjfetE3KcLXlfXrIBMM7Ve3JNEU1dL01vZ7THJXYWS6mIvGnOK+nW4GxsgReW8an5HlE1qF3O0r0vmpttZ6tK0NjxZFrUIVJwE+X/rJrRIS7eJJsgLoI4HD37AMcQ3rGY4/mnR7JitqNj4TNq+P/XNNl7wkjmRLOruLrOdShKON1ZvmaZ9BKUYI02FjxRntO8MPOrR2ImdRpTp+1rGtLlWWe0MxmPOkIQIsPKocIeitjWXIgNErcdzulagizd+cmcf2PPOyNkOd7yVv1xxxLy2ePYsHdGaYxIgM0xJ+NNrNpLz9/3W2quhEt4JL6jIhnIuvIUd67SQLwf7qy2jS3lLwbkBqPJpalAE=
SET DECRYPTED=1
)
exit /b

:QUIT
IF EXIST ISOFOLDER\ rmdir /s /q ISOFOLDER\
IF EXIST %ENCRYPTEDESD%.bak (
del /f /q %ENCRYPTEDESD% >nul 2>&1
ren %ENCRYPTEDESD%.bak %ENCRYPTEDESD%
)

Windows Update error code 80072F78


This happens if you receive a bad internet connection speed. Just wait a few minutes and try again.

You can also try to clean whole windows update cache with
net stop wuauserv
rd %systemroot%\SoftwareDistribution /Q /S
SC sdshow wuauserv
SC sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
wuauclt.exe /detectnow
Source:
http://windows.microsoft.com/en-us/windows7/windows-update-error-80072f78-80090305-or-8009033f

UserParameter, Permission denied, zabbix

For example you have zabbix_agentd.conf with very simple command
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
DebugLevel=3
EnableRemoteCommands=1
Server=zabbix.catonrug.net
Hostname=another.catonrug.net

UserParameter=count_failed,cat /var/path/to/log.out | grep "failed" | wc -l
At the zabbix server side you have configured item similar to this
When you restart agent
/etc/init.d/zabbix-agent restart
And the /var/log/zabbix/zabbix_agentd.log file after a minute or two says
 13244:20141006:151140.810 Got signal [signal:15(SIGTERM),sender_pid:14078,sender_uid:0,reason:0]. Exiting ...
 13241:20141006:151140.810 Got signal [signal:15(SIGTERM),sender_pid:14078,sender_uid:0,reason:0]. Exiting ...
 13246:20141006:151140.810 Got signal [signal:15(SIGTERM),sender_pid:14078,sender_uid:0,reason:0]. Exiting ...
 13243:20141006:151140.811 Got signal [signal:15(SIGTERM),sender_pid:14078,sender_uid:0,reason:0]. Exiting ...
 13245:20141006:151140.818 Got signal [signal:15(SIGTERM),sender_pid:14078,sender_uid:0,reason:0]. Exiting ...
 13241:20141006:151142.810 Zabbix Agent stopped. Zabbix 2.0.10 (revision 40809).
 14091:20141006:151142.939 Starting Zabbix Agent [another.catonrug.net]. Zabbix 2.0.10 (revision 40809).
 14093:20141006:151142.940 agent #0 started [collector]
 14094:20141006:151142.941 agent #1 started [listener]
 14095:20141006:151142.941 agent #2 started [listener]
 14096:20141006:151142.941 agent #3 started [listener]
cat: /var/path/to/log.out: Permission denied
Check the current SELinux policy status
This will give output similat to:
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          permissive
Policy version:                 24
Policy from config file:        targeted
Try out to turn of SELinux policy with
setenforce 0
Now check again status
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   permissive
Mode from config file:          permissive
Policy version:                 24
Policy from config file:        targeted
Now restart zabbix agent
/etc/init.d/zabbix-agent restart
Check the log
tail -f /var/log/zabbix/zabbix_agentd.log
Related:
http://www.linuxcommand.org/man_pages/setenforce8.html

Sunday, October 5, 2014

Saturday, October 4, 2014

Windows 10 Technical Preview direct link

http://iso.esd.microsoft.com/W9TPI/FD54DF81A4CCF4511BA1445C606DDBA2/WindowsTechnicalPreview-x86-EN-US.iso
mirror: https://drive.google.com/file/d/0B7dpbSKok53ldVo4b2JvT3ZaUjQ
781370cab9951117579dcdf38c12227f
73ac23ad89489855f33ca224f196327740057e2e

http://iso.esd.microsoft.com/W9TPI/FD54DF81A4CCF4511BA1445C606DDBA2/WindowsTechnicalPreview-x64-EN-US.iso
mirror: https://drive.google.com/file/d/0B7dpbSKok53lTExDU0dIRWlGMDA
9005dce26734bcde7f912c2c51ab1127
eb75a3d3c0f621f175b75dc65db036d0e00eac43

Wednesday, October 1, 2014

Install cs50.h library on Wheezy Raspbian

move to include direcotry
cd /usr/include
copy this content to clipboard
/****************************************************************************
 * CS50 Library 6
 * https://manual.cs50.net/library/
 *
 * Based on Eric Roberts' genlib.c and simpio.c.
 *
 * Copyright (c) 2013,
 * Glenn Holloway <holloway@eecs.harvard.edu>
 * David J. Malan <malan@harvard.edu>
 * All rights reserved.
 *
 * BSD 3-Clause License
 * http://www.opensource.org/licenses/BSD-3-Clause
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 * * Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * * Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 * * Neither the name of CS50 nor the names of its contributors may be used
 *   to endorse or promote products derived from this software without
 *   specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ***************************************************************************/

#ifndef _CS50_H
#define _CS50_H

#include <float.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>

/**
 * Our own data type for string variables.
 */
typedef char* string;

/**
 * Reads a line of text from standard input and returns the equivalent
 * char; if text does not represent a char, user is prompted to retry.
 * Leading and trailing whitespace is ignored.  If line can't be read,
 * returns CHAR_MAX.
 */
char GetChar(void);

/**
 * Reads a line of text from standard input and returns the equivalent
 * double as precisely as possible; if text does not represent a
 * double, user is prompted to retry.  Leading and trailing whitespace
 * is ignored.  For simplicity, overflow and underflow are not detected.
 * If line can't be read, returns DBL_MAX.
 */
double GetDouble(void);

/**
 * Reads a line of text from standard input and returns the equivalent
 * float as precisely as possible; if text does not represent a float,
 * user is prompted to retry.  Leading and trailing whitespace is ignored.
 * For simplicity, overflow and underflow are not detected.  If line can't
 * be read, returns FLT_MAX.
 */
float GetFloat(void);

/**
 * Reads a line of text from standard input and returns it as an
 * int in the range of [-2^31 + 1, 2^31 - 2], if possible; if text
 * does not represent such an int, user is prompted to retry.  Leading
 * and trailing whitespace is ignored.  For simplicity, overflow is not
 * detected.  If line can't be read, returns INT_MAX.
 */
int GetInt(void);

/**
 * Reads a line of text from standard input and returns an equivalent
 * long long in the range [-2^63 + 1, 2^63 - 2], if possible; if text
 * does not represent such a long long, user is prompted to retry.
 * Leading and trailing whitespace is ignored.  For simplicity, overflow
 * is not detected.  If line can't be read, returns LLONG_MAX.
 */
long long GetLongLong(void);

/**
 * Reads a line of text from standard input and returns it as a
 * string (char *), sans trailing newline character.  (Ergo, if
 * user inputs only "\n", returns "" not NULL.)  Returns NULL
 * upon error or no input whatsoever (i.e., just EOF).  Leading
 * and trailing whitespace is not ignored.  Stores string on heap
 * (via malloc); memory must be freed by caller to avoid leak.
 */
string GetString(void);

#endif
The content has been extracted from
http://mirror.cs50.net/appliance50/2014/debs/dists/trusty/main/binary-i386/library50-c_6-0_i386.deb

With super user permissions create a new file
sudo nano cs50.h
Now paste all content in clipboard
Press ctrl+x to exit editing
Press y to accept saving
Hit enter to chose the same filename

Compile the file
sudo gcc -c -ggdb -std=c99 cs50.c -o cs50.o
i do not know what this does but it creates libcs50.a from cs50.o
sudo ar rcs libcs50.a cs50.o
Set to the booth of files that only owner can change the content, everyone can read and none can execute
sudo chmod 0644 cs50.h libcs50.a
move the library to /usr/lib
sudo mv libcs50.a ../lib
Source:
http://askubuntu.com/questions/111744/how-to-install-custom-c-library

Related:
http://cs50.tv/2014/fall/

Compile c code in wheezy raspbian

To compile c code install clang library
sudo apt-get clang -y
Once you have done you can compile with
clang -o filename source.c
example code
#include 
int main(void) {
printf ("How you doing?\n");
}
Related:
http://cs50.tv/2014/fall/

Blog Archive