ez-connect / blog Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Following this to practice Vim.
You can install Neovim from download, package, or source in just a few seconds.
Unix
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Windows
curl -fLo vimfiles\autoload\plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Enter command :version
in Vim to see system vimrc
file.
Enter :echo $VIM
to see $VIM
location.
Photo by Petter Lagson | Unsplash
sudo apt update
sudo apt install squid3
sudo apt install apache2-utils
sudo htpasswd -c /etc/squid/passwords <user-name>
You will be prompted for entering the password. Enter and confirm it.
Backup the default config file
sudo mv /etc/squid/squid.conf /etc/squid/squid.conf.backup
Make a new config file
sudo nano /etc/squid/squid.conf
Enter this in the config file
auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwords
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 24 hours
auth_param basic casesensitive off
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_access deny all
dns_v4_first on
forwarded_for delete
via off
http_port 3128
auth_param basic credentialsttl 24 hours
: after 24 hours, user/pass will be asked - again.auth_param basic casesensitive off
: case sensitive for user is off.dns_v4_first on
: use only IPv4 to speed up the proxy.forwarded_for delete
: remove the forwarded_for http header which would expose your source to the destinationvia off
: remove more headers to avoid exposing the source.http_port 8888
: port 3128
is used for proxy. You can choose any port.sudo service squid restart
To check the status
sudo service squid status
Please use these for manual proxy setup
ip
or domain
name3128
Photo by Rami Al-zayat | Unsplash
To publish on the Play Store, you need to give your app a digital signature. Use the following instructions to sign your app.
keytool -genkey -v -keystore key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias <alias-name>
Enter keystore password: <a-generated-pwd>
Re-enter new password: <a-generated-pwd>
What is your first and last name?
[Unknown]: Freemind
What is the name of your organizational unit?
[Unknown]:
What is the name of your organization?
[Unknown]: Freemind
What is the name of your City or Locality?
[Unknown]:
What is the name of your State or Province?
[Unknown]:
What is the two-letter country code for this unit?
[Unknown]: VN
Is CN=Freemind, OU=Unknown, O=Freemind, L=Unknown, ST=Unknown, C=VN correct?
[no]: yes
Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
for: CN=Freemind, OU=Unknown, O=Freemind, L=Unknown, ST=Unknown, C=VN
Enter key password for <hidden-alias-name>
(RETURN if same as keystore password):
[Storing key.jks]
Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore key.jks -destkeystore key.jks -deststoretype pkcs12".
Put key.jks
into <app dir>/android/
Create a file named <app dir>/android/key.properties
that contains a reference to your keystore:
storePassword=<password from previous step>
keyPassword=<password from previous step>
keyAlias=key
storeFile=../key.jks
Add code before android
block
/// Signing
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
Sign the app with signing configuration info
/// Signing
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
Use that siging key for both debug
and release
buildTypes {
debug {
signingConfig signingConfigs.release
}
release {
signingConfig signingConfigs.release
}
}
keytool.exe -list -v -keystore key.jks -alias <alias-name> -storepass <your-store-pwd> -keypass <your-key-pwd>
Alias name: <alias-name>
Creation date: May 13, 2020
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Freemind, OU=Unknown, O=Freemind, L=Unknown, ST=Unknown, C=VN
Issuer: CN=Freemind, OU=Unknown, O=Freemind, L=Unknown, ST=Unknown, C=VN
Serial number: 11637590
Valid from: Wed May 13 09:26:35 ICT 2020 until: Sun Sep 29 09:26:35 ICT 2047
Certificate fingerprints:
MD5: ...
SHA1: ...
SHA256: ...
Signature algorithm name: SHA256withRSA
Firebase doesn't work if you don't provide
SHA-1
in the Firebase console.
TBD
This is an updated version of Jonathan White’s blog post about Null-aware operators in Dart. Most of the content is unchanged with the exception of the examples provided at the end of the post, which help make the post easier to understand.
Null-aware operators in dart allow you to make computations based on whether or not a value is null. It’s shorthand for longer expressions.
Photo by Max Chen | Unsplash
Use ??
when you want to evaluate and return an expression IFF another expression resolves to null.
exp ?? otherExp
is similar to
((x) => x == null ? otherExp : x)(exp)
Use ??=
when you want to assign a value to an object IFF that object is null. Otherwise, return the object.
obj ??= value
is similar to
((x) => x == null ? obj = value : x)(obj)
Use ?.
when you want to call a method/getter on an object IFF that object is not null (otherwise, return null).
obj?.method()
is similar to
((x) => x == null ? null : x.method())(obj)
You can chain ?. calls, for example:
obj?.child?.child?.getter
If obj, or child1, or child2 are null, the entire expression returns null. Otherwise, getter is called and returned.
Dart 2.3 brings in a spread operator (…) and with it comes a new null aware operator, ?...
!
Placing
...
before an expression inside a collection literal unpacks the result of the expression and inserts its elements directly inside the new collection.
So now, these two are equivalent.
List numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
and
List lowerNumbers = [1, 2, 3, 4, 5];
List upperNumbers = [6, 7, 8, 9, 10];
List numbers = […lowerNumbers…upperNumbers];
To benefit from the new null aware operator, you can use it like this.
List lowerNumbers = [1, 2, 3, 4, 5];
List upperNumbers = [6, 7, 8, 9, 10];
List numbers = […lowerNumbers?…upperNumbers];
which is the equivalent to
List numbers = [];
numbers.addAll(lowerNumbers);
if(upperNumbers != null) {
numbers.addAll(upperNumbers);
}
Photo by Chris Ried | Unsplash
class Example {
static final instance = Example._();
Example._() {
// Private constructor
}
void hello() {
print('Hello world');
}
}
// Call `hello` method
Example.instance.hello();
class Example {
factory Example() => _instance;
static final _instance = Example._internal();
<!-- // Example._internal(); -->
void hello() {
print('Hello world');
}
}
// Call `hello` method
Example().hello();
Copyright © Ez-Connect 2020 . All rights reserved.
Made with Mundana Theme by WowThemes.net
These're some ways you can use to measure execution time of a piece of your code.
Stopwatch stopwatch = new Stopwatch()..start();
doSomething();
print(stopwatch.elapsed);
To perform custom performance traces programmatically and measure wall/CPU time of arbitrary segments of Dart code similar to what would be done on Android with systrace, use dart:developer Timeline utilities to wrap the code you want to measure such as
import 'dart:developer';
Timeline.startSync('interesting function');
doSomething();
Timeline.finishSync();
Then open your app’s Observatory’s timeline page, check the ‘Dart’ recording option and perform the function you want to measure.
See more in Tracing Dart code performance
Before installing any Linux distros for WSL, you must ensure that the "Windows Subsystem for Linux" optional feature is enabled:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
You can install your preferred distro(s) using PowerShell 1 or Curl
Invoke-WebRequest -Uri https://aka.ms/wsl-debian-gnulinux -OutFile Debian.appx -UseBasicParsing
curl.exe -L -o ubuntu-1604.appx https://aka.ms/wsl-debian-gnulinux
WSL 2 is a new version of the architecture in WSL that changes how Linux distros interact with Windows. WSL 2 has the primary goals of increasing file system performance and adding full system call compatibility. Each Linux distro can run as a WSL 1, or a WSL 2 distro and can be switched between at any time. WSL 2 is a major overhaul of the underlying architecture and uses virtualization technology and a Linux kernel to enable its new features. 2
Enable the 'Virtual Machine Platform' optional component and make sure WSL is enabled
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Set a distro to be backed by WSL 2 and make WSL 2 your default architecture using the command line
wsl --set-version Debian 2
wsl --set-default-version 2
To verify what versions of WSL each distro is using use the following command (only available in Windows Build 18917 or higher):
wsl -l -v
NAME STATE VERSION
* Debian Stopped 2
https://docs.microsoft.com/en-us/windows/wsl/wsl2-faq
WIN+R -> services.msc
Find LxssManager
Right-click -> Restart
Or PowerShell command:
Get-Service LxssManager | Restart-Service
Or
debian --shutdown
debian config --default-user root
Only change nameserver in
/etc/resolv.conf
will works on some cases.
On WSL
###
# Fix net work issues
###
# Switch to root
sudo su
# Delete auto-generated files
rm /etc/resolv.conf
rm /etc/wsl.conf
# Enable changing /etc/resolv.conf
# Enable extended attributes on Windows drives
cat <<EOF > /etc/wsl.conf
[network]
generateResolvConf = false
[automount]
enabled = true
options = "metadata"
mountFsTab = false
EOF
# Use cloudflare for DNS resolution
cat <<EOF > /etc/resolv.conf
nameserver 1.1.1.1
EOF
Exit WSL then on Windows Terminal as Admin
wsl --shutdown
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns
Photo by CoinView App | Unsplash
Override LaunchImage*.png
in ios/Runner/Assets.xcassets/LaunchImage.imageset
with your assets.
In Android, there are two separate screens that you can control:
launch screen
shown while your Android app initializessplash screen
that displays while the Flutter experience initializes.They are defined in styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@android:color/white</item>
</style>
</resources>
We will use the same assets for both launch screen and splash screen.
...
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
Then upgrade launch_background.xml
with a specific bitmap.
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="@drawable/launch_screen" />
</item>
</layer-list>
launch_sreen.png
must be copied toandroid/app/src/main/res/drawable-xxxhdpi/
before use.
Describe all available tags
We use Cloudflare nameservers to serve.
Type | Value |
---|---|
NS | iris.ns.cloudflare.com |
NS | phil.ns.cloudflare.com |
On namecheap for example
Configure a subdomain, example docs.freemind.vn
.
Setup DNS records for Surge
Type | Name | Content |
---|---|---|
CNAME | docs | na-west1.surge.sh |
A 1 | docs | 45.55.110.124 |
Deloy to the custom domain param
$ surge path/to/my-project docs.freemind.vn
?> You can save your custom domain so you don’t have to type it in each time you deploy. Simply add a CNAME file (no extension) to the root of the project you’re deploying, and Surge will use that automatically.
$ echo docs.freemind.vn > CNAME
Setup DNS records for ZEIT
Type | Name | Content |
---|---|---|
CNAME | docs | alias.zeit.co |
If your DNS hosted with Cloudflare, try to disable Proxied -> DNS Only to verify.
Setup DNS records for Netlify
Type | Name | Content |
---|---|---|
CNAME | docs | site-name.netlify.com2 |
Setup DNS records for Pages
Type | Name | Content |
---|---|---|
CNAME 3 | docs | freemind.gitlab.io |
A 1 | docs | 35.185.44.232 |
It may take up to 30 minutes before the site is available after the first deployment
Navigate New Pages Domain, add the docs.freemind.vn
subdomain.
Sync a fork of a repository to keep it up-to-date with the upstream repository.
Before you can sync your fork with an upstream repository, you must configure a remote that points to the upstream repository in Git.
Photo by Medium
List the current configured remote repository for your fork
git remote -v
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
Specify a new remote upstream repository that will be synced with the fork
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
Verify the new upstream repository you've specified for your fork
git remote -v
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
Fetch the branches and their respective commits from the upstream repository. Commits to master
will be stored in a local branch, upstream/master
.
git fetch upstream
Check out your fork's local master branch
git checkout master
Merge the changes from upstream/master into your local master branch. This brings your fork's master branch into sync with the upstream repository, without losing your local changes.
git merge upstream/master
Ez-Connect
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.