Skip to main content

Create a 1 TB Linux virtual Machine in Azure

Azure is great, and the greatest thing is that you can run tiny Linux virtual machines and attach lots of cheap hdd space on them. You will only pay what you use of this extra space.

Here is how you can create a LINUX virtual machine in the Azure, and then attach an extra 1TB disk on to it. After that you can install owncloud or whatever and replace this 10$/month dropbox subscription you had.

  1. Login to your Azure
  2. Create a new Ubuntu 15 (Vivid) VM on any tier
  3. In the AzureĀ dashboard for the VM, attach a new disk with 1023GB
  4. SSH to your VM on port 22 and authenticate
  5. Run :Ā sudo fdisk /dev/sdc
  6. Type : n
  7. Type : p
  8. Hit : Enter
  9. Hit : Enter
  10. Type : w
  11. Run sudo mkfs -t ext4 /dev/sdc1
  12. Run sudoĀ mkdir /data
  13. Run sudoĀ mount -t ext4 dev/sdc1 /data

You know have the new disk in the /data folder for use šŸ™‚

You can verify by running :Ā lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

Stopping All Exchange Services

  1. # Stop MSExchangeADTopology Dependent services
  2. foreach ($svc in get-service MSExchangeADTopology) {$dep = $svc.dependentservices}
  3. foreach ($aa in $dep)
  4. {
  5. get-service $aa.Name | select Name,status
  6. stop-service $aa.Name
  7. get-service $aa.Name | select Name,status
  8. }
  9.  
  10. # Stop all services with the name Exchange
  11. $svcstatus = get-service *exchange* | select name,status
  12. foreach ($mystatus in $svcstatus -eq "Running") {$mystatus = $svcstatus.Status}
  13. foreach ($ab in $svcstatus)
  14. {
  15. get-service $ab.Name | select Name,status
  16. stop-service $ab.Name -f
  17. get-service $ab.Name | select Name,status
  18. }

Grab Dell Warranty Date on Dell Devices

This script will grab the warranty end date based on a server’s/laptop’s/PC’s asset tag number and then, it will create a file on your C drive named warranty.txt
You can modify the behaviour as needed. Just create a new file and put the code in it, then rename it to warrantycheck.vbs.
This is usefull for massive checks on servers and workstation or Labtech automation

 

  1. Option Explicit
  2. Dim SoapRequest
  3. Dim url, regkey, svctag
  4. Dim warrantyRows, warrantyCols
  5. Dim objShell, objXML, objWMI, objHTTP, NodeList
  6. Dim i, result
  7. SoapRequest = "<?xml version=""1.0"" encoding=""utf-8""?> <soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""> <soap:Body> <GetAssetInformation xmlns=""http://support.dell.com/JigsawWebServices/""> <guid>11111111-1111-1111-1111-111111111111</guid> <applicationName>Warranty Information Lookup</applicationName> <serviceTags>!SERVICETAG!</serviceTags> </GetAssetInformation> </soap:Body></soap:Envelope>"
  8. url = "http://xserv.dell.com/jigsawwebservices/AssetService.asmx"
  9. regkey = "HKEY_LOCAL_MACHINE\Software\DellWarrantyInfo"
  10. set objShell = WScript.CreateObject("WScript.Shell")
  11. set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
  12. If InStr(UCase(objWMI.ExecQuery("Select Manufacturer From Win32_ComputerSystem").ItemIndex(0).Manufacturer), "DELL") = 0 then Err.Raise 2, "This is not Dell malaka"
  13. svctag = Trim(objWMI.ExecQuery  ("Select SerialNumber from Win32_BIOS").ItemIndex(0).SerialNumber)
  14. SoapRequest = Replace(SoapRequest, "!SERVICETAG!", svctag)
  15. Set objHTTP = CreateObject("Msxml2.XMLHTTP")
  16. objHTTP.open "POST", URL, false
  17. objHTTP.setRequestHeader "Content-Type", "text/xml"
  18. objHTTP.setRequestHeader "SOAPAction", "http://support.dell.com/JigsawWebServices/GetAssetInformation"
  19. objHTTP.send SoapRequest
  20. result = objHTTP.responseText
  21. Set objXML = CreateObject ("Msxml2.DOMDocument")
  22. objXML.LoadXml result
  23. If not objXML.SelectSinglenode ("//faultstring") is nothing then
  24.     Err.Raise 1,  "Error:" & objXML.SelectSingleNode("//faultcode").text, Trim(objXML.SelectSingleNode("//faultstring").text)
  25. End If
  26. Set NodeList = objXML.SelectNodes("//Asset/Entitlements/EntitlementData")
  27. set warrantyCols = NodeList.item(0)
  28. dim filesys, filetxt, getname, path
  29. Set filesys = CreateObject("Scripting.FileSystemObject")
  30. Set filetxt = filesys.CreateTextFile("c:\warranty.txt", True)
  31. path = filesys.GetAbsolutePathName("c:\warranty.txt")
  32. getname = filesys.GetFileName(path)
  33. filetxt.WriteLine(Mid(warrantyCols.SelectSingleNode("EndDate").text,1,10) & " (" & svctag & ")")
  34. filetxt.Close

RTMP HLS nginx php Server – The easy way

Tired of paying for Wowza media server? Unreal media server?
Tired of trying to find a decent tutorial on how to build your own nginx rtmp server with php and hls support?
UPG.GR has the solution for you with a few easy steps (as usual)
*Note that a referral link to digital ocean is included in this article that will grant you 10$ of credit to try for free with no obligations

If you are an advanced linux user and have your own linux box, just run the following command on any Ubuntu and your done! :Ā curl -sL https://raw.githubusercontent.com/upggr/UPG.GR-MEDIA-SERVER/master/nginx.sh | sudo bash –

Step 1
Go to digital ocean and get a free account with 10$ credits (to use for a month)

1

Step 2

Enter your email and select a password

2

 

Step 3

Activate your account and login to get your free credit

3

 

Step 4

Create a new droplet

4

Step 5

Select the 10$ a month droplet. This will be enough for testing and for about 100 concurrent users. Enter the subdomain of a domain you control For example if you have a domain upg.gr enter “streamer.upg.gr”. If you do not have domain just enter there whatever and you will access your server with the ip you will be provided.

5

Step 6

Select a country near you.

6

Step 7

Select your favorite UBUNTU distro. Watch this space for a Centos tutorial – request it in the comments and I ll do it for you.

7

Step 8

Create droplet :

8

Step 9

Wait for your droplet to be created

9

Step 10

Check your email for your login credentials

10

Step 11

In the meantime go your registra or dns server to map the subdomain you chose to the ip of the server you got in your email. In my example I am using the free tier of cloudflare to manage my dns (http://cloudflare.com)

11

Step 12

Go back to digital ocean and start the console (or just putty to the ip on port 22 and authenticate)

12

 

13

 

Step 13

Login using the credentials you are provided in your email

14

Step 14

Enter “sudo -s”

15

Step 15

Enter “sudo apt-get install curl -y”

Enter “curl -sL https://raw.githubusercontent.com/upggr/UPG.GR-MEDIA-SERVER/master/nginx.sh | sudo bash -”

16

Step 16

Your server is up! you can test it on the address you specified. Port 80 and 1935 is open. port 80 for the player port 1935 for the streaming. You may stream usingĀ Adobe Media Encoder (free). Remember to use the h.264 codec and not the default VP6 !

17

Connect and start streaming

Step 17

Test your streamer by visiting the main interface on the subdomain you defined or the ip address you were provided. I have preparedĀ 5 streams. stream1,stream2,stream3,stream4,stream518

Step 18

Review my github projects where you can find all the source code for this project.

There are 3 projects :

https://github.com/upggr/UPG.GR-MEDIA-SERVER Ā  – Ā Automation

https://github.com/upggr/nginx – Fork of the latest working nginx server (1.9.2)

https://github.com/upggr/nginx-rtmp-module – Latest fork of the rtmp module for nginx

You can edit the nginx.conf to suit you needs at :Ā /usr/local/nginx/conf/nginx.conf

You can find the html files that show the web interface at :Ā /usr/local/nginx/html

 

To do :

Web administration for nginx.conf options
Ftp server to edit the php files

Please comment here to encourage me to continue with this project.

Playing rtmp streams on a webpage

I don’t understand why there is no opensource way of playing an rtmp stream on a webpage using any of the free opensource players.

The only options available seem to be the flowplayer with a watermark and jwplayer again with a watermark. Then some others have released similar players with watermarks (again). Only premium versions seem to be able to play rtmp streams without watermarks. This is crazy.

Anyway, here is a way to create your own streaming player for the web with no watermarks and top quality for your streams. Soon I will be releasing a totally opensource project on Github about this..

So following my example you will be creating a flash rtmp player.

Just head to Adobe and download a trial version of Flash Builder. At the time of this post the version was 4.6

Install as usual, sign in with a free adobe id to activate the trial and create a new MXML application. Just use all the defaults!

Edit the main.mxml file and add something like this :


<s:VideoPlayer id="vidPlyr"
loop="false"
muted="false"
left="100" right="100"
top="100" bottom="100"
horizontalCenter="0" verticalCenter="0"
autoPlay="true">
<s:source>
<s:DynamicStreamingVideoSource host="rtmp://stream.upg.gr:1935/ioniantv/stream" streamType="live">
<s:DynamicStreamingVideoItem streamName="stream" />
</s:DynamicStreamingVideoSource>
</s:source>
</s:VideoPlayer>

 

Go to Project – Export Release Build

Go where the project is and get the bin-release folder contents and upload them to your server. If you used all the defaults you will be able to access the video page at http://your.domain.com/bin-release/Main.html

You are done!!! Here is your watermark free rtmp streaming player. I believe you get the point and you can start renaming things as needed and adding code to fallback to mobile etc.

Watch this space for a full fallback player that I will be releasing soon. Comment here and I’ll release it sooner šŸ™‚

 

Delete Windows Files with Permissions

Here is how to delete windows files that you cannot figure out the permissions.

For example files on a drive that contains an older windows installation, the users folder, the program data folder, the program files folder, the windows folder, the windows.old folder etc

The scripts bellow will create a context menu in your explorer. When you right click on a folder it will start taking ownership of the files, After this, you will be able to delete them!

You will need to import the following in to your registry :

 

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\runas]
@="Take Ownership"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\*\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Take Ownership"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

If you want to remove the right click menu use this :

Windows Registry Editor Version 5.00


[-HKEY_CLASSES_ROOT\*\shell\runas]

[-HKEY_CLASSES_ROOT\Directory\shell\runas]

Here is a zip file containing the reg keys that you can just import and you are done with out playing around with the code above : TakeOwnership

Steps to Configure PowerShell (Part 2)

PowerShell 2.0 and later

If you use PowerShell at home or in an unmanaged environment, here are some additional steps you should consider to make PowerShell fully functional.

To allow Administrators to connect to your machine remotely and run cmdlets like Get-Process or Get-Service, you may want to enable the Remote Administration firewall exception. Open PowerShell with Administrator privileges, and run this:

 
PS> netsh firewall set service remoteadmin enable

IMPORTANT: Command executed successfully.
However, "netsh firewall" is deprecated;
use "netsh advfirewall firewall" instead.
For more information on using "netsh advfirewall firewall" commands
instead of "netsh firewall", see KB article 947709
at http://go.microsoft.com/fwlink/?linkid=121488 .

Ok.
 

The command returns that there is a newer command and that it is deprecated, but it will still work and enable the firewall exception. The newer command is much harder to use because its parameters are localized, and you would need to know the exact names of the firewall exceptions.

To really use the remoting capabilities of cmdlets, you would also have to start the RemoteRegistry service and set it to auto start:

 
PS> Start-Service RemoteRegistry

PS> Set-Service -Name Remoteregistry -StartupType Automatic
 

Now you can use Get-Process, Get-Service, or other cmdlets that expose a ā€“ComputerName parameter to connect to your computer remotely, provided the user running these cmdlets has Administrator privileges on your system.

In a simple peer-to-peer home environment, it would be sufficient to set up Administrator accounts with the same name on each computer.

Twitter This Tip! ReTweet this Tip!


Posted Dec 03 2014, 06:00 AM by ps1

Steps to Configure PowerShell (Part 1)

PowerShell 2.0 and later

If you use PowerShell at home or in an unmanaged environment, here are some steps you should consider to make PowerShell fully functional.

To check out the PowerShell version you use, try this:

 
PS> $PSVersionTable.PSVersion.Major

4 
 

If the version is lower than 4, investigate why you are using an outdated version, and whether you can upgrade.

To enable script execution, run this:

 
PS> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force
 

You will now be able to run script located anywhere. If you are a beginner and want some extra protection, replace ā€œBypassā€ with ā€œRemoteSignedā€. This will keep you from running PowerShell scripts that were downloaded from the Internet or received as email attachment. It will also prevent you from running scripts outside your own domain, though.

Twitter This Tip! ReTweet this Tip!


Posted Dec 02 2014, 06:00 AM by ps1