Tag Archives: Windows

Manual WAMP stack

For future reference…

PHP

  1. Download an x64 Thread Safe zip from php.net.
  2. Read the note about Visual C++ Redistributable in the sidebar of that download page, and install the one required for your version.
  3. Unzip somewhere and add to PATH.
  4. Pick a php.ini and adjust as necessary (enabled extensions, etc.).
  5. In particular, make sure the following is not commented out:
    extension_dir = "ext"
  6. Check that it works:
    php --version

Composer

  1. Download the Windows Installer from getcomposer.org.
  2. Run the installer..
  3. Check that it works:
    composer --version

Apache

  1. Download the Apache Win64 zip from apachelounge.com.
  2. Read the note about Visual C++ Redistributable above the downloads on that download page, and install the required one.
  3. Unzip somewhere and adjust httpd.conf as necessary (paths, enabled modules, etc.).
  4. Install as service:
    httpd.exe -k install
  5. Start the service.
  6. Check that it works:
    start http://localhost

Apache with PHP

  1. Add the following to httpd.conf.
    LoadModule php7_module C:/path/to/php/php7apache2_4.dll
    <IfModule php7_module>
        DirectoryIndex index.html index.php
        AddHandler application/x-httpd-php .php
        PHPIniDir "C:/path/to/php"
    </IfModule>
  2. Add an index.php to your DocumentRoot for testing, e.g.:
    <?php phpinfo();
  3. Restart the Apache service.
  4. Check that it works:
    start http://localhost

MariaDB

  1. Download a Windows x86_64 MSI Package via mariadb.org.
  2. Run the installer.
  3. Optionally add some of the following to my.ini under mysqld section:
    ; Only listen on localhost
    bind-address=127.0.0.1

    ; Enable logging of queries

    ; (probably bad in production, but very helpful for development debugging)
    general-log=1
    general-log-file=queries.log
    log-output=file
  4. Restart the service, if you changed anything in the ini.
  5. Check that it works by connecting with HeidiSQL or any other SQL client.

How to repair broken user folders in Windows

Tried moving my Documents/Desktop/Music/etc folders to a Google Drive mounted via Drive File Stream. Seemed to work well at first, but after the first reboot Windows clearly wasn’t happy and kept complaining about not finding the Desktop or the Documents…

Possibly because that drive seems to be mounted a bit too slowly (i.e. happens a bit after one has logged in)? And/or because it’s just mounted in a way Windows doesn’t like?

Either way, here’s how to…

Fix

  1. Open up regedit.
  2. Go to:
    Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
  3. Update all incorrect values.
  4. Reboot.

That seems to have fixed it for me anyways…

Source: scottiestech.info

Windows 10 Default app removal

PowerShell commands to remove apps. Just a note to self… and possibly others…

Remember to not just run all the commands blindly… do the list first, then actually consider what you’re removing…

List

Get-AppxPackage | Select-Object -expandproperty name

Remove

Get-AppxPackage *xbox* | Remove-AppxPackage
Get-AppxPackage *windowsalarms* | Remove-AppxPackage
Get-AppxPackage *windowscommunicationsapps* | Remove-AppxPackage
Get-AppxPackage *windowscamera* | Remove-AppxPackage
Get-AppxPackage *windowsmaps* | Remove-AppxPackage
Get-AppxPackage *officehub* | Remove-AppxPackage
Get-AppxPackage *people* | Remove-AppxPackage
Get-AppxPackage *skypeapp* | Remove-AppxPackage
Get-AppxPackage *getstarted* | Remove-AppxPackage
Get-AppxPackage *zune* | Remove-AppxPackage
Get-AppxPackage *solitairecollection* | Remove-AppxPackage
Get-AppxPackage *bing* | Remove-AppxPackage
Get-AppxPackage *onenote* | Remove-AppxPackage
Get-AppxPackage *sway* | Remove-AppxPackage
Get-AppxPackage *messaging* | Remove-AppxPackage
Get-AppxPackage *phone* | Remove-AppxPackage

Get-AppxPackage drawboardpdf | Remove-AppxPackage
Get-AppxPackage freshpaint | Remove-AppxPackage
Get-AppxPackage SurfaceHub | Remove-AppxPackage
Get-AppxPackage flipboard | Remove-AppxPackage

Reinstall

Get-AppxPackage -AllUsers| Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

Source: www.howtogeek.com

How to lower USB headphone audio levels on Windows

When connecting my headphones via a simple USB-plug, the audio levels are often way, way, too loud. Today I had to turn the volume all the way down to 2% for the audio just to be OK’ish. That’s not very usable, and also kind of scary…

Finally found something to fix it!

  1. Install Equalizer APO
  2. Open up “C:\Program Files\EqualizerAPO\config\config.txt”
  3. Replace its contents with:
    Preamp: -30 dB
  4. And adjust that level as necessary…

Now I can finally use the volume bar in Windows, and the volume media keys on my keyboard properly. And no longer do I need to be afraid of suddenly having my eardrums shattered if the audio were to move a percentage or two… or, even worse, reset to max…

Batch convert SVG to PNG on Windows using Inkscape

Needed to convert several SVGs to PNG, and discovered the free Inkscape easily can be used in batch scripts.

The following .bat file will convert all SVGs dropped on it to a PNG with height 48 placed next to the original SVG. More options can be found in the Inkscape manual.

@echo off
for %%f in (%*) do (
    echo %%~f
    "C:\Program Files\Inkscape\inkscape.exe" ^
      -z ^
      --export-background-opacity=0 ^
      --export-height=48 ^
      --export-png="%%~dpnf.png" ^
      --file="%%~f"

)

Setting up GPG signing for Git/GitHub on Windows

What I did to get from working GPG to green and verified signatures for Git commits and tags on GitHub.

  1. Find the long id of the Signing key we want to use:
    🔶 > gpg --edit-key alice
    gpg (GnuPG) 2.0.30; Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Secret key is available.

    pub  4096R/AA79CCAE  created: 2017-08-23  expires: never       usage: SC
                         trust: ultimate      validity: ultimate
    sub  4096R/62275E24  created: 2017-08-23  expires: never       usage: S 👈
    sub  4096R/4AEA9524  created: 2017-08-23  expires: never       usage: E
    [ultimate] (1). Alice Person (alice) <alice.person@example.com>
    [ultimate] (2)  Alice Person (alice) <alice@example.org>

    🔶 gpg> quit

    🔶 > gpg --list-secret-keys --keyid-format LONG alice
    sec   4096R/8C0BBECBAA79CCAE 2017-08-23
    uid                          Alice Person (alice) <alice.person@example.com>
    uid                          Alice Person (alice) <alice@example.org>
    ssb   4096R/6ADB9D4262275E24 2017-08-23 👈
    ssb   4096R/33F2E1644AEA9524 2017-08-23

    Note: So in this case we want 6ADB9D4262275E24

  2. Configure git and (optionally) make it sign commits and tags by default:
    🔷 > git config --global user.name "Alice Person"
    🔷 > git config --global user.email "alice.person@example.com"
    🔶 > git config --global user.signingkey "6ADB9D4262275E24"
    🔷 > git config --global commit.gpgsign true
    🔷 > git config --global tag.forceSignAnnotated true
    🔷 > git config --global push.gpgsign if-asked
    🔶 > where gpg
    C:\Program Files (x86)\GNU\GnuPG\pub\gpg.exe
    🔶 > git config --global gpg.program "C:/Program Files (x86)/GNU/GnuPG/pub/gpg.exe"
    🔶 > echo no-tty >> %APPDATA%\gnupg\gpg.conf

    Note: If repo specific, just skip --global and run the command in the repo instead.

Test it…

  1. Do a commit:
    🔷 > git init gpg-test
    🔷 > cd gpg-test
    🔷 > touch file.txt
    🔶 > git commit -a -m "Signed commit"
    [master (root-commit) 2814856] Signed commit
     1 file changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 file.txt

    Note: If not using commit.gpgsign true, one can also use -S to explicitly sign a commit.

  2. Verify commit was signed:
    🔷 > git log --show-signature
    commit 2814856365a07b3deb374f1337258102c06b77ef
    gpg: Signature made 08/23/17 06:18:50 W. Europe Daylight Time^M
    gpg:                using RSA key 6ADB9D4262275E24^M
    gpg: Good signature from "Alice Person (alice) <alice.person@example.com>" [ultimate]^M
    gpg:                 aka "Alice Person (alice) <alice@example.org>" [ultimate]^M
    Author: Alice Person <alice.person@example.com>
    Date:   Wed Aug 23 06:18:48 2017 +0200

        Signed commit
  3. Add a signed tag, using -s:
    🔶 > git tag v1 -m "Signed tag"

    Note: If not using tag.forceSignAnnotated true, one can also use -s to explicitly sign a tag.

  4. Verify tag was signed:
    🔷 > git tag -v v1
    gpg: Signature made 08/23/17 06:34:18 W. Europe Daylight Time
    gpg:                using RSA key 6ADB9D4262275E24
    gpg: Good signature from "Alice Person (alice) <alice.person@example.com>" [ultimate]
    gpg:                 aka "Alice Person (alice) <alice@example.org>" [ultimate]
    object 53e7f2e637eaf3c47b5dcad30b57be7b6829be02
    type commit
    tag v1
    tagger Alice Person <alice.person@example.com> 1503462856 +0200

    Signed tag

Add GPG key to GitHub

  1. Export the public key:
    🔶 gpg -a --export alice > public.txt
  2. Copy it.
  3. Go to GPG keys on GitHub.
  4. New GPG Key.
  5. Paste it.
  6. Add GPG Key.
  7. Pushed commits and tags should now look verified, as in this post: GPG signature verification

Sources: help.github.com, StackOverflow, git-scm.com