通过Proxy使用apt

Nothing would be more frustrating than to install apt packages from sources outside of China, especially from PPA. If you try to update the c++ compiler to g++-6 or g++-7 through

sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt-get install g++-7 -y

it may takes your hours to get it done.

But if you have a socks5 proxy out there, things will become better. The idea is to use apt-get behind a socks5 proxy.

tsocks and proxychains are common-used tools for this purpose. Here I choose proxychains over tsocks due to the DNS issue of tsocks mentioned by this.

  1. install proxychains sudo apt-get install proxychains
  2. setup for proxychains in /etc/proxychains.conf
    Since my socks5 proxy server is running at 127.0.0.1 through port 1080, my setting is socks5 127.0.0.1 1080 at the last line of /etc/proxychains.conf.
  3. using proxychaines with apt-get sudo proxychains apt-get update sudo proxychains apt-get install g++-7 -y Done in minutes!

You can also use the proxychains for other software as below:

sudo proxychains synaptic
proxychains julia

Enjoy!

原文链接:https://yuzhangbit.github.io/tools/use-apt-get-behind-socks5-proxy/

Win+R默认以管理员权限运行

2487208

I’m getting closer to installing Windows 10 fresh on a new drive, and I want to achieve what you see in the screenshot again. Only, I forgot how I did it. Can you help?

I get this when I press WinKey+R. I had to do something to make it be this way, but I don’t remember what it was. I want this for my new installation of Windows, whenever I start doing that.

Edit: I don’t want some alternative way to do what this does. I want this. I want my Run dialog box to look like this every time I access it.

Update:

I figured it out. I had a feeling that I would figure it out after asking. Isn’t that how it goes sometimes?

In the Registry, you go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System and change EnableLUA to 0. The default is 1. Reboot, and it’s done.

I wasn’t figuring it out before because I kept asking Google various kinds of questions that I thought would lead me to the answer. I never just simply Googled “This task will be created with administrative privileges”. Once I did that, I found the answer.

原文链接:https://www.overclock.net/threads/run-dialog-box-this-task-will-be-created-with-administrative-privileges-i-forgot-how-i-achieved-this-help-please-solved.1778333/

让OneDrive客户端支持本地SharePoint服务器

Configure OneDrive for SharePoint Server Subscription Edition or 2019

To set up OneDrive with SharePoint Server Subscription Edition or 2019, you can either use Group Policy or set the registry keys directly.

Note

For settings that require an organization ID, if you sync a single domain, you can use OP1. Do not use this if you sync multiple domains.

The Known Folder Move settings don’t work for SharePoint Server.

Using Group Policy

Configure the following two Group Policy objects to configure OneDrive to be used with SharePoint Server Subscription Edition or 2019:

Specify SharePoint Server URL and organization name

The URL (SharePointOnPremFrontDoorUrl) is used by the sync app to authenticate the user and to set up syncing of the user’s SharePoint Server hosted personal OneDrive site. The organization name (SharePointOnPremTenantName) lets you specify the name of the root folder that will be created in File Explorer. If you don’t supply an organization name, the sync app will use the first segment of the URL as the name. For example, office.sharepoint.com would create the folder “office”.

Specify the OneDrive location in a hybrid environment

This setting (SharePointOnPremPrioritization) lets you specify if the sync app should first set up a sync relationship with SharePoint in Microsoft 365 (the default) or the SharePoint on-premises server if the user identity exists in both identity providers. The sync application’s Settings dialog can be used to “Add Account” the same identity for the other SharePoint realm after the first has been configured (if the user identity exists in both).

You should be able to find these Group Policy objects using the Group Policy Editor (gpedit.msc) when navigating to Computer Configuration\Administrative Templates\OneDrive. If the OneDrive folder is not present, you can add the OneDrive Group Policy template by copying the following two files from the OneDrive installation folder after you have installed the latest OneDrive sync app on that computer:

  • C:\Users\username\AppData\Local\Microsoft\OneDrive\onedrivesyncclientversion\adm\OneDrive.admx to C:\Windows\PolicyDefinitions\OneDrive.admx
  • C:\Users\username\AppData\Local\Microsoft\OneDrive\onedrivesyncclientversion\adm\OneDrive.adml to C:\Windows\PolicyDefinitions\en-US\OneDrive.adml

To automate this copying using PowerShell, use: PowerShell

Get-ChildItem -Recurse -Path "$env:LOCALAPPDATA\Microsoft\OneDrive" -Filter "OneDrive.admx" | ? FullName -like "*\adm\OneDrive.admx" | Copy-Item -Destination "$env:WINDIR\PolicyDefinitions" -Force
Get-ChildItem -Recurse -Path "$env:LOCALAPPDATA\Microsoft\OneDrive" -Filter "OneDrive.adml" | ? FullName -like "*\adm\OneDrive.adml" | Copy-Item -Destination "$env:WINDIR\PolicyDefinitions\en-US" -Force

More information: Learn how to manage OneDrive using Group Policy

By setting the registry keys

Alternatively, you can also directly configure the following underlying registry keys:

KeyTypeValueRequired
HKLM:\Software\Policies\Microsoft\OneDrive\SharePointOnPremFrontDoorUrlStringhttps://sharepoint.contoso.localrequired
HKLM:\Software\Policies\Microsoft\OneDrive\SharePointOnPremPrioritizationDWORD (32-bit)1optional
HKLM:\Software\Policies\Microsoft\OneDrive\SharePointOnPremTenantNameStringContosooptional

Mac configuration

To configure sync with SharePoint Server in a Mac environment, you can use the SharePointOnPremFrontDoorUrl, SharePointOnPremPrioritizationPolicy, and SharePointOnPremTenantName settings. For more information, see Deploy and configure the new OneDrive sync app for Mac.

原文链接:https://docs.microsoft.com/en-us/sharepoint/install/configure-syncing-with-the-onedrive-sync-app

解决Parallels Desktop 16虚拟机启动网络加载失败

1) Close Parallels completely
2) In Terminal, type : sudo nano /Library/Preferences/Parallels/network.desktop.xml (this will open the Terminal text editor “nano”)
3) Type your admin password to access the file
4) Locate this line -1 it could be also value 1 and replace whatever value there with 0, so you should have 0
5) Press Ctrl+O to ask for a save, then Ctrl+X to close the editor
In Terminal, type : sudo nano /Library/Preferences/Parallels/dispatcher.desktop.xml
find 0 and change 0 to 1
again Press Ctrl+O to ask for a save, then Ctrl+X to close the editor
6) Close Terminal and open Parallels like normal, your VM should load like on Catalina and before

原文链接:https://gist.github.com/m4vr0x/072ad1ad4c53f1b9a7a2b9a9e8e90290

利用Windows Server DNS服务封禁域名

You can use this topic to learn how to configure DNS policy in Windows Server® 2016 to create query filters that are based on criteria that you supply.

Query filters in DNS policy allow you to configure the DNS server to respond in a custom manner based on the DNS query and DNS client that sends the DNS query.

For example, you can configure DNS policy with query filter Block List that blocks DNS queries from known malicious domains, which prevents DNS from responding to queries from these domains. Because no response is sent from the DNS server, the malicious domain member’s DNS query times out.

Another example is to create a query filter Allow List that allows only a specific set of clients to resolve certain names.

Query filter criteria

You can create query filters with any logical combination (AND/OR/NOT) of the following criteria.

NameDescription
Client SubnetName of a predefined client subnet. Used to verify the subnet from which the query was sent.
Transport ProtocolTransport protocol used in the query. Possible values are UDP and TCP.
Internet ProtocolNetwork protocol used in the query. Possible values are IPv4 and IPv6.
Server Interface IP addressIP address of the network interface of the DNS server that received the DNS request.
FQDNFully Qualified Domain Name of record in the query, with the possibility of using a wild card.
Query TypeType of record being queried (A, SRV, TXT, etc.).
Time of DayTime of day the query is received.

The following examples show you how to create filters for DNS policy that either block or allow DNS name resolution queries.

Note

The example commands in this topic use the Windows PowerShell command Add-DnsServerQueryResolutionPolicy. For more information, see Add-DnsServerQueryResolutionPolicy.

Block queries from a domain

In some circumstances you might want to block DNS name resolution for domains that you have identified as malicious, or for domains that do not comply with the usage guidelines of your organization. You can accomplish blocking queries for domains by using DNS policy.

The policy that you configure in this example is not created on any particular zone – instead you create a Server Level Policy that is applied to all zones configured on the DNS server. Server Level Policies are the first to be evaluated and thus first to be matched when a query is received by the DNS server.

The following example command configures a Server Level Policy to block any queries with the domain suffix contosomalicious.com.

Add-DnsServerQueryResolutionPolicy -Name "BlockListPolicy" -Action IGNORE -FQDN "EQ,*.contosomalicious.com" -PassThru

Note

When you configure the Action parameter with the value IGNORE, the DNS server is configured to drop queries with no response at all. This causes the DNS client in the malicious domain to time out.

原文链接:https://docs.microsoft.com/en-us/windows-server/networking/dns/deploy/apply-filters-on-dns-queries