Skip to content

Instantly share code, notes, and snippets.

@mezcel
Last active August 24, 2019 21:41
Show Gist options
  • Select an option

  • Save mezcel/9d830cf2f24815569a6b3655f03a3153 to your computer and use it in GitHub Desktop.

Select an option

Save mezcel/9d830cf2f24815569a6b3655f03a3153 to your computer and use it in GitHub Desktop.
WLS Notes

Bash Reminders

chattr

# The chattr command in Linux is a file system command which is used for changing the attributes of a file in a directory. The primary use of this command is to make several files unable to alter for users other than the superuser.

chattr +i test.txt

Windows Subsystem for Linux Documentation link

Enable WLS via Powershell

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

To use GNU Desktop GUI Apps:

  • Download X Server on Win10 xming or XLaunch vcxsrv
  • Get a Distro from the Windows Store. I prefer Debian on Win10... despite prefering Arch or Alpine on everything else.
  • Tell Bash you want to run an app through the X Server
## Manually Launch a standalone window of the Geany text editor
## In this case X Server was set to 0.0

DISPLAY=:0.0 geany

## or
## DISPLAY=:0.0 xfce4-session
## DISPLAY=:0.0 startxfce4

Access Win10 Dirs from WLS:

## CD into the Win10 Downloads Dir

cd /mnt/c/Users/MyUserName/Downloads

Access WLS from Win10:

  • you have to ssh into it similar to a remote session

1. wls debian

sudo apt update
sudo apt upgrade
sudo apt install xfce4 xfce4-goodies task-xfce-desktop
sudo apt install build-essential autoconf libgtk-3-dev
sudo apt install geany geany-plugins
sudo apt install git
sudo apt install arc-theme
echo "export DISPLAY=:0.0" >> ~/.bashrc

2. win10

Install XLaunch vcxsrv. I prefer that over Xming.

  • use default settings
  • check Disable access controll

3. wls debian

xfce4-session
Get-AppxPackage *3dbuilder* | Remove-AppxPackage
Get-AppxPackage *windowscamera* | Remove-AppxPackage
Get-AppxPackage *officehub* | Remove-AppxPackage
Get-AppxPackage *skypeapp* | Remove-AppxPackage
Get-AppxPackage *zunemusic* | Remove-AppxPackage
Get-AppxPackage *windowsmaps* | Remove-AppxPackage
Get-AppxPackage *solitairecollection* | Remove-AppxPackage
Get-AppxPackage *bingfinance* | Remove-AppxPackage
Get-AppxPackage *zunevideo* | Remove-AppxPackage
Get-AppxPackage *bingnews* | Remove-AppxPackage
Get-AppxPackage *onenote* | Remove-AppxPackage
Get-AppxPackage *people* | Remove-AppxPackage
Get-AppxPackage *windowsphone* | Remove-AppxPackage
Get-AppxPackage *bingsports* | Remove-AppxPackage
Get-AppxPackage *soundrecorder* | Remove-AppxPackage
Get-AppxPackage *bingweather* | Remove-AppxPackage
Clear-History
Stop-Process -name firefox
Stop-Computer

win10 pro notes

Win+R

secpol.msc

Select Application Control Policies in the left, then click Applocker.

Click Packaged app Rules:

Right click the right pane and select Create new rule:

The Create new rule wizard will be opened. Click Next to open its next page:

On the Permissions page, set Action to Deny, leave User or Group as Everyone:

Click Next, then click Use an installed packaged app as a reference -> Select:

In the app list, select Windows Spotlight(Microsoft.Windows.ContentDeliveryManager) and click OK:

Move the slider to the Package Name option as shown below, then click Create:

That's it!

https://www.laptopmag.com/articles/uninstall-restore-windows-10-builtin-apps

https://www.thewindowsclub.com/remove-candy-crush-saga-windows-10

C/C++ for Visual Studio Code

  • link
  • Note: The C/C++ extension does not include a C++ compiler or debugger.

dependancies

make a directory called C:\mingw-64 to install programms into

Make a system variable:

  • right clock on start
  • click "system"
  • click "advanced system settings"
  • click "Environment Variables"
  • highlight the "Path" row within "Ststem variables"
  • click "Edit"
  • click "New", enter C:\mingw-w64\bin

compiler

/* c_cpp_properties.json */
{
    "name": "Win32",
    "includePath": [
        "${workspaceFolder}"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE"
    ],
    "compilerPath": "C:\\mingw-w64\\bin\\gcc.exe",
    "intelliSenseMode": "clang-x64",
    "browse": {
        "path": [
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true,
        "databaseFilename": ""
    }
}

build code

/* tasks.json */
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build hello world",
            "type": "shell",
            "command": "g++",
            "args": [
                "-g", "helloworld.cpp"
            ]
        }
    ]
}

debug code

/* tasks.json */
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/a.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\mingw\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "build hello world"
        }
    ]
}
"%LocalAppData%\Programs\Microsoft VS Code Insiders"
"%UserProfile%\.vscode-insiders"
"%AppData%\Code - Insiders"
"%AppData%\Visual Studio Code - Insiders"
"%AppData%\Microsoft\Windows\Start Menu\Programs\Visual Studio Code - Insiders"
%appdata%\local\Programs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment