Windows 10

How to stop auto-reboot of Windows 10 after update

Windows 10 is really annoying with auto-update, auto-reboot etc. I found that thing to work (thanks to NyxRyu on reddit):
  • Open up C:\Windows\system32\
  • Right click on "MusNotification.exe"
  • Go to "Properties"
  • Go to "Security" tab
  • Click "Advanced"
  • At the top you'll see "Owner: TrustedInstaller" with a link to "Change" it. Click the "Change" link.
  • Type in your username and press Check Names. It should underline your username (and possibly prepend it with your machine name) if it finds it. If it doesn't, you'll need to figure out your username and make sure you get this part right.
  • Press "OK". Dismiss any warnings or alerts.
  • Press "OK" until ALL DIALOGS ARE DISMISSED (DO NOT APPLY PERMISSIONS YET).
  • Re-open the properties of MusNotifications.exe and go to the "Security" tab (seriously it's important that you REOPEN it after changing the owner).
  • Click "Edit..."
  • Click on "SYSTEM" in the list of "Group or user names"
  • Click on the "Deny" checkboxes for "Read & execute" this should also automatically "Deny" for "Read", if not then do so yourself.
  • Click Ok to dismiss the dialog again.

Git

  • Get rid of Auto windows/linux line endings in git:
    git config --global core.autocrlf false
    
  • Using SourceTree on Windows, pointing by Samba share to linux machine and editing files from both machines may trigger a state, where there is no real file-content differences, but git on windows shows stuff like:
    diff --git a/bjson_c/clean.sh b/bjson_c/clean.sh
    old mode 100755
    new mode 100644
    
    The solution is to change core.filemode flag:
    git config core.fileMode false
    

JavaScript

What is $ (the Dollar Sign) in JavaScript scripts ?

We all use the call to document.getElementById() a lot. So, the industry made an informal standard.
$() is a common shortcut to document.getElementById().
The example implementation can be:

function $(element)
{
    var elements = new Array();
    for (var i = 0; i < arguments.length; i++)
    {
        var oneArg = arguments[i];
        if (typeof oneArg == string)
        {
            element = document.getElementById(oneArg);
        }
        if (arguments.length == 1)
        {
            return element;
        }
        elements.push(element);
    }
    return elements;
}

You can of course implement your own, or use any of public JavaScript libraries that use it.

Some advanced example can be JQuery, which uses $() as the selector. Usage consist of calls:

$('#id') - this would "select" element by id
$('.xxx') - this would "select" all elements, which have CSS class "xxx" attached

and gives more - just read about selectors in JQuery documentation.

Browsers

How to test websites for compatibility with old Internet Explorers ?

Testing your websites code, appearance etc. for compatibility with old Internet Explorer versions is really easy.
Microsoft distributes Virtual PC images for testing purposes. You can find them here.
A lot to download (several gigabytes), but then you can run fully working versions of IE6, IE7, IE8 and IE9 all at the same time at one PC.

Opera: Where does Opera store cookies?

  • Enter opera:about in Opera address bar. You'll find some paths list.
  • Look through the paths - search for filename cookies4.dat - this is your cookies file.
  • For Opera 11.0 on Windows Vista the path is C:\Users\<your username>\AppData\Roaming\Opera\Opera\

Linux

Nmap: quick scan for open devices

If you don't have nmap installed:
sudo apt-get install nmap
Then:
nmap -sn 192.168.1.0/24

Linux graphics card (GPU) acceleration

Check VGA on linux:
lspci -nn | grep -E 'VGA|Display'
The Chrome URL is:
chrome://gpu
Radeon driver compatibility list: https://help.ubuntu.com/community/RadeonDriver
dmesg | egrep 'drm|radeon'

How to delete all files in subdirectories using wildcards ?

Try understanding and then using one of these lines:
find . -name "*.d" -exec rm -rf {} \;
find . -name "*.d" -exec rm {} \;
Warning: you are messing with files removal... Do not remove too much :)

How to remove all .svn directories?

To remove all .svn dirs:
find . -name .svn -exec rm -rf {} \;
To be sure you won't remove too much, try listing them before removal:
find . -name .svn -exec ls {} \;

How to run Linux programs on linux machine, but display graphics using X-Server on Windows machine

You can do it simply installing and configuring X-Ming and ssh on windows and then running some scripts...
Read the "Short XMING how-to" (somewhere around on this site).

Short XMING how-to

  • download XMING + FONTS
    google for XMING or checkout the url: http://sourceforge.net/projects/xming
    last time I used Xming (6.9.0.31) + default Xming-fonts
  • download and install ssh
    ssh can be easily downloaded as a part of Cygwin. Download cygwin (cygwin.org or use google) and run its setup. Then mark the ssh and install it.
    Or just try downloading simply ssh.exe and some dlls (google):
    cygcrypto-0.9.8.dll
    cygminires.dll
    cygwin1.dll
    cygz.dll
    needed by ssh.exe
    also ssh-keygen.exe would be usefull for generating default keygens
  • now try starting Xming on Windows machine
    try running this code:
    "c:\Program Files\Xming\xming" :1 -multiwindow -clipboard -emulate3buttons  -silent-dup-error -clipupdates 5 -ac
    
    of course, save it as some .bat file for future use.
    Also notice, that for 64bit windows, you need to change path
    "c:\Program Files\Xming\xming"
    
    to the more 64bit like:
    "C:\Program Files (x86)\Xming\xming"
    
    as this is default for win32 applications installed on win64...

    After running Xming, the big X icon should be visible in your windows tray.
    The most important part is the :1, as this determines index of X-display to emulate. You will pass this number later to runned software on linux machine. If you need more than one linux machine displaying on your windows, just run many X-Mings with this number different for each of it. Like this:
    "c:\Program Files\Xming\xming" :1 -multiwindow -clipboard -emulate3buttons  -silent-dup-error -clipupdates 5 -ac
    "c:\Program Files\Xming\xming" :2 -multiwindow -clipboard -emulate3buttons  -silent-dup-error -clipupdates 5 -ac
    "c:\Program Files\Xming\xming" :3 -multiwindow -clipboard -emulate3buttons  -silent-dup-error -clipupdates 5 -ac
    

  • start some software on your linux machine, redirecting its display to your windows machine
    code to run is:
    ssh root@192.168.1.100 "xterm -display 192.168.1.200:1 < /dev/null >& /dev/null &"
    
    where:
    • root is your user name on linux machine
    • 192.168.1.100 ip address to your linux machine
    • xterm the software to be run on linux machine
    • 192.168.1.200 the ip of windows machine. The started application will connect to this addres, looking for X-Server (in your case, the X-Ming).
    • 1 the number after : is the number matching the X-display you opened before on X-Ming.
    After running this code, you will pass the password, and DONE. The xterm window should be opened on your windows machine.

  • if still not running
    Something was wrong. Check that:
    • Xming is running - the big X should be visible in your windows tray.
    • ssh login is ok - run some command line (windows -> start -> cmd) on windows machine, and try to call ssh directly to login to linux machine into text console:
      ssh root@192.168.1.100
      

    • all IP's provided are ok
    • ssh is visible for command line. Just open command line (windows -> start -> cmd) and run
      ssh
      
      if it fails (some error like "unrecognized command"), then check if ssh.exe is present in your cygwin installation (typically C:\cygwin\bin).
      If it's not present - run Cygwin setup again and install ssh.
      If it is present, but still not visible, check the PATH system variable. Simply enter (in command line)
      PATH
      
      end look what paths are listed. If it's not there - add
      C:\cygwin\bin;
      
      to PATH environment settings (normally My Computer -> Properties -> Environment Variables).


  • if running ok
    some other common runs I use frequently...
    The Konsole from KDE:
    ssh root@192.168.50.8 "konsole -display 192.168.50.2:2 < /dev/null >& /dev/null &"
    
    KDevelop:
    ssh root@192.168.50.8 "kdevelop -display 192.168.50.2:2 < /dev/null >& /dev/null &"
    

  • Advanced: auto-authenticated login to Linux machine
    • generete keys for non-password logon on windows machine
      ssh-keygen.exe -t rsa
      
      remember where the keys are stored (the path after "Enter file in which to save the key"), or just enter your own path

    • enter nothing (just hit "enter") when asked for password (will ask twice).
    • copy generated key (from the path where keys were stored, the file is usually called id_rsa.pub and is stored in your "\user\.ssh" directory).
      The key is stored as just a single line of text.
    • on linux machine:
      add your public key to ~/.ssh/authorized_keys as a single line of text.
      if the file "authorized_keys" doesn't exist, just create it.

  • some related materials:
    man to ssh: http://unixhelp.ed.ac.uk/CGI/man-cgi?ssh+1
    if you know polish language, read that: http://jakilinux.org/aplikacje/sztuczki-z-SSH/

How to disable .bash_history

in ~/.bashrc
add line:
HISTFILE=/dev/null

allow login to Gnome as root

Login as root to Linux graphic environment is generally not recommended. That's why Gnome and KDE in most distros have root login disabled.
To allow login to Gnome as root:
add to file /etc/gdm/custom-conf
[security]
AllowRoot=yes
AllowRemoteRoot=yes

Windows 7 or Windows Vista installation

changing user logon policy (works on 7 and Vista)

  • click windows
  • enter
    cmd
  • run
    control userpasswords2

disable UAC

control panel -> User Account and Family -> Change security settings
in windows PL:
panel sterowania -> konta uzytkownikow -> wlacz lub wylacz kontrola konta uzytkownika

turn off the hibernation

This kills the big hibernation file (hiberfill.sys).
powercfg -h off
Notice, this may need administrator privileges (try opening command prompt as administrator).

open command prompt as administrator on windows 7

There are many ways, which give same result:
1. open the Start Menu, type "cmd", then press CTRL+SHIFT+ENTER.
2. open the Start Menu -> All Programs -> Accesories, then RIGHT CLICK on Command prompt, and click on RUN AS ADMINISTRATOR.
3. open the Start Menu, type "cmd", then RIGHT CLICK on cmd in "found" pane, and click on RUN AS ADMINISTRATOR.

turn off the explorer view settings storage per folder

http://www.vistax64.com/tutorials/70819-windows-explorer-folder-view-settings.html

Samba authentication problems

enter regedit, edit the key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
change the value "3" to value "1".
Meanings of that value can be found here:
http://technet.microsoft.com/en-us/library/cc960646.aspx
Also for reference:
0 – Clients use LM and NTLM authentication, but they never use NTLMv2 session security. Domain controllers accept LM, NTLM, and NTLMv2 authentication.
1 – Clients use LM and NTLM authentication, and they use NTLMv2 session security if the server supports it. Domain controllers accept LM, NTLM, and NTLMv2 authentication.
2 – Clients use only NTLM authentication, and they use NTLMv2 session security if the server supports it. Domain controller accepts LM, NTLM, and NTLMv2 authentication.
3 – Clients use only NTLMv2 authentication, and they use NTLMv2 session security if the server supports it. Domain controllers accept LM, NTLM, and NTLMv2 authentication.
4 – Clients use only NTLMv2 authentication, and they use NTLMv2 session security if the server supports it. Domain controller refuses LM authentication responses, but it accepts NTLM and NTLMv2.
5 – Clients use only NTLMv2 authentication, and they use NTLMv2 session security if the server supports it. Domain controller refuses LM and NTLM authentication responses, but it accepts NTLMv2.

Samba performance problems

Try this if you experience low bandwidth or long seek times during transfers to/from Samba server.
This happens mostly due to multi-media related transfers - e.g. when jumping to different part of a movie or mp3.
Try:
  • the key
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\NetworkThrottlingIndex
    may not exist. Even if it exists - it probably has the value == 10.
    Try setting this key to ffffffff (the type of key should be DWORD).
    Then restart the service ""Multimedia Class Scheduler Service" (polish: "Harmonogram klas multimediów").
  • Try disabling some dependencies of "Windows Audio":
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Audiosrv
    delete MMCSS from DependOnService
    and restart your computer.
    Now disable the service MMCSS - that's all !

network problems related to MTU

To check what MTU is not going out through your network gateways, run:
ping -f -l 1432 kongregate.com
where 1432 is a size of a packet, and kongregate.com is a server you got the problems with.
Try starting from a packet size of 1500, then decrease it by steps of 8 (1492, 1484, 1476 and so on) to probe for a best value.
You should go down to the number, that makes you pass the ping packets without problems (e.g. 1432).
Then use this value in following commands:
netsh interface ipv4 show subinterfaces
Find the name for your connection (e.g. "local connection") and use the following formula:
netsh interface ipv4 set subinterface "THE CONNECTION NAME" mtu=1432 store=persistent

Synergy in KDE setup

in /etc/kde4/kdm/Xsetup:
/usr/bin/killall synergyc
/usr/bin/synergyc 192.168.0.2
in /etc/kde4/kdm/Xstartup, before the code of:
/sbin/initctl -q emit desktop-session-start DISPLAY_MANAGER=kdm USER=$USER
add:
/usr/bin/killall synergyc
sleep 1

Windows 8

Networks shares - disable default admin shares - $C, $D, $E

To disable automatic admin shares of known as $C, $D, $E, $F, ...
Add the registry key. Path is:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
Add the DWORD (32-bit) key called AutoShareWKS with value 0
Then reboot the system (yes, reboot is needed for that).
JavaScript failed !
So this is static version of this website.
This website works a lot better in JavaScript enabled browser.
Please enable JavaScript.