Posts

Showing posts from July, 2019

Back up Windows WSL distros

The best way to backup your distros is available in Windows Version 1809 and later. You can export your entire distribution to a tarball using the wsl --export command. You can then import this distro back into WSL using the wsl --import command, allowing you to backup and save states of your WSL distributions. Please note that traditional backup services that backup files in your Appdata folders (like Windows Backup) will not corrupt your Linux files.

Installing WSL with GUI using VcXsrv

VcXsrv is a Windows X-server based on the xorg git sources (like xming or cygwin's xwin). You can download it from https://sourceforge.net/projects/vcxsrv/ After installing VcXsrv, start XLaunch and do some setup. First you can choose whether you like One Large Window or Fullscreen option, then choose Start no client, and then check Disable access control. When finished, you will see big window blank screen appear. Now install Desktop Environment for your WSL. XFCE4 is lightweight therefore a good choice. $ sudo apt install xfce4 After the installation finished, make sure you're in your home directory. Edit .bashrc for some configuration. $ cd ~ $ nano .bashrc Go to the last line and write this : export DISPLAY=:0.0 Exit your WSL and run it again. The format of this command is actually [host]:<display>.[screen] where [host] refers to a network host name. Since we left it blank, we're going to use our local machine instead. Each host can have multiple display. Now afte

Expand Linux Disk on Hyper-V

Use GParted to increase disk size of a Linux native partition Increasing the virtual hard disk from the Hyper-V manager Booting into the GParted Live CD Now that you have increased the hard disk space of the virtual machines, you need to boot into the GParted live CD to continue, you can download this here. See more: https://www.rootusers.com/use-gparted-to-increase-disk-size-of-a-linux-native-partition/

Temporarily disable a foreign key constraint in MySQL

SET FOREIGN_KEY_CHECKS=0; make sure to SET FOREIGN_KEY_CHECKS=1; when finish.

Passive income is when you continually get paid for work you only did once

Passive income is   an attractive method of making extra money.

Fixed GlassFish asadmin "The system cannot find the path specified." error

Go to asenv.bat file in config directory Change AS_JAVA="C:/Program Files(x86)/Java/" to your correct location Retry asadmin.

What is Ads.txt File

The "Ads.txt" is simply a text file that can be placed on your blog's server and carries information about the advertising networks used by the blog's owner and the owner authorised these ads networks to show ads on the website. The main idea behind using this ads.txt file is to protect publishers from frauds and viruses as you will only authorise those ads network to display ads on your website which you're aware of and hence any malware script that showing ads on your blog without your permission from any unknown sources, cannot perform the task it ought to do.

New cross-platform PowerShell

PowerShell Core PowerShell Core is now an Open Source project on GitHub. See the following articles for more information on installing PowerShell Core on various supported and experimental platforms. https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6#powershell-core

How to add socks proxy to ssh config file? - Stack Overflow

Host example.com User i88ca Port 22 IdentityFile ~/.ssh/id_rsa DynamicForward 1080

Reset Network Settings to Default in Windows 10

Run the following command as Admin: netsh winsock reset

How to Keep Your Linux SSH Session Alive

Global Configuration Add the following line to the /etc/ssh/ssh_config file: ServerAliveInterval 60 The number is the amount of seconds before the server with send the no-op code. Current User Configuration Add the following lines to the ~/.ssh/config file (create if it doesn’t exist) Host *   ServerAliveInterval 60 Make sure you indent the second line with a space. Per-Host Configuration If you only want to enable keep alive for a single server, you can add that into the ~/.ssh/config file with the following syntax: Host *hostname.com    ServerAliveInterval 60

The List-Unsubscribe header record was defined in RFC 2369 in 1998.

The List-Unsubscribe header record is intended to allow universal access to an unsubscribe function, though its implementation has been relatively weak. The idea is simple: if the List-Unsubscribe header is sent with an email it should include a mailto link to allow unsubscribing by email and an http address to allow redirection to an unsubscribe page. When the ISP receives the email and recognizes the header record it should then present an unsubscribe link in its framework.

Cleanup and Reset Network Adapters in Command Prompt

1. Open an elevated command prompt. 2. Type the command below in the elevated command prompt, and press Enter.  If you run the command and receive an error referring to NetSetupDeleteObject, run the netcfg –d command until it’s successful.  netcfg -d 3. When finished, restart the computer to apply.

How to make sure git fork is always up-to-date

Simply run git pull upstream master and you are ready to hack.

Map network drive to Azure File Storage

Create Storage Account First of all you need to create a storage account that will give you access to the File Storage service that you are going to use. Create File Storage After your Azure Storage Account is created you need to create a File Share. From the storage account you have previously created, select Files and add a new File Service. Name your service and set a Quota in GB, to limit the total size of files on the share. Map Network Drive Now that your file share is created, you can map it as a network drive in your computer. The url for your share which can be found if you click on the properties button on your file share toolbar. Note that you should change https:// to \\ in order to mount the file share. The storage account name and the storage account key to allow access to your file share. The connect method can be found if you click on the properties button on your file share toolbar.

Set up fingerprint sign-in on Dell Laptops

If you find it difficult to sign in by fingerprint to your Dell laptops, the trick is to repeatedly try to set up your same finger until the computer tells you that the finger has already set up for the account. 

Scan Windows system from command line

Use Windows shortcut keys Win + X to launch the Jump List, and then select Windows PowerShell (Admin). 2. Type sfc /scannow into the dialog box and hit the key Enter. Windows will do its jobs if it detects any corrupted files.

Common Java Keytool Keystore Commands

If you need to check the information within a certificate, or Java keystore, use these commands. Check a stand-alone certificate keytool -printcert -v -file mydomain.crt Check which certificates are in a Java keystore keytool -list -v -keystore keystore.jks Check a particular keystore entry using an alias keytool -list -v -keystore keystore.jks -alias mydomain Other Java Keytool Commands Delete a certificate from a Java Keytool keystore keytool -delete -alias mydomain -keystore keystore.jks Change a Java keystore password keytool -storepasswd -new new_storepass -keystore keystore.jks Export a certificate from a keystore keytool -export -alias mydomain -file mydomain.crt -keystore keystore.jks List Trusted CA Certs keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts Import New CA into Trusted Certs keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore $JAVA_HOME/jre/lib/security/cacerts

How to install zulu JDK 7

apt-key adv --keyserver hkp:// keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9 && \ echo "deb http://repos.azulsystems.com/ubuntu stable main" >> /etc/apt/sources.list.d/zulu.list && \ apt-get -qq update && \ apt-get -qqy install zulu-7=7.29.0.5 && \ rm -rf /var/lib/apt/lists/* https://github.com/zulu-openjdk/zulu-openjdk/blob/master/7u222-7.29.0.5/Dockerfile

MySQL GTID replication

Traditional MySQL replication is based on relative coordinates — each replica keeps track of its position with respect to its current master's binary log files. GTID enhances this setup by assigning a unique identifier to every transaction, and each MySQL server keeps track of which transactions it has already executed. This permits "auto-positioning," the ability for a replica to be pointed at a master instance without needing to specify a binlog filename or position in the CHANGE MASTER statement.

Multi-source replication use replication channels

Multi-source replication use replication channels, which allow a slave to replicate from multiple masters. Multi-source replication is a great way to consolidate data that has been sharded for production or simplify the analytics process by using the same server.

A GTID is a globally unique id given to all transactions executed on a GTID-enabled MySQL hosting server.

GTID's are a combination of the UUID of the server where a particular transaction has been committed, and the sequence number of that transaction on that particular server. This makes the GTID's globally unique.

Display the GlassFish Server Version

asadmin> version Or $ ./asadmin version Version = Payara Server Open Source Edition 4.1.152.1 #badassfish (build 193) Command version executed successfully.

SSH Always forwarding a port

If you have ports that you always want to forward, you can use the LocalForward directive in the SSH config file. For example, if you wanted to forward ports 8888 and 18888, you could update the file as follows: Host remote-linux-machine User myuser HostName remote-linux-machine.mydomain LocalForward 127.0.0.1:8888 127.0.0.1:8888 LocalForward 127.0.0.1:18888 127.0.0.1:18888

Rsync Show Progress Bar While Copying Files

You need to use the --progress or -P option which show progress during file transfer.

Set a default Linux distribution on Windows

Set a default distribution The default WSL distribution is the one that runs when you run wsl on a command line. wsl -s <DistributionName>, wsl --setdefault <DistributionName> Sets the default distribution to <DistributionName>. Versions Earlier than Windows 10 Version 1903 WSL Config (wslconfig.exe) is a command-line tool for managing Linux distributions running on the Windows Subsystem for Linux (WSL).

Check Windows 10 Version

First of All open the run command on your computer by pressing “Windows + R“. Now, type the command -“WINVER”. A pop up will appear with the Windows 10 build version.

Fixed Ubuntu Unit sshd.service could not be found.

sudo apt install openssh-server

Developing in the Windows Subsystem for Linux with Visual Studio Code

The Visual Studio Code Remote - WSL extension lets you use the Windows Subsystem for Linux (WSL) as your full-time development environment right from VS Code. You can develop in a Linux-based environment, use Linux specific toolchains and utilities, and run and debug your Linux-based applications all from the comfort of Windows. https://code.visualstudio.com/docs/remote/wsl

Generate an SSH key pair

If you do not have a key, run the following command in a local terminal / command prompt to generate an SSH key pair: ssh-keygen -t rsa -b 4096

How to get ps id of glassfish

$ ps ax | grep glassfish | grep -v grep | awk '{print $1}'

Using SSHFS to access files on your remote host

SSHFS is a secure remote filesystem access protocol that builds up from SFTP. It provides advantages over something like a CIFS / Samba share in that all that is required is SSH access to the machine. Note: For performance reasons, SSHFS is best used for single file edits and uploading/downloading content. If you need to use an application that bulk reads/write to many files at once (like a local source control tool), rsync is a better choice.

Aurora Serverless PostgreSQL Generally Available

The PostgreSQL-compatible edition of Aurora Serverless is now generally available, offering an alternative to the MySQL version.

Primary and secondary groups on Linux

There are two types of groups — primary and secondary. The primary group is the one that's recorded in the /etc/passwd file, configured when an account is set up. When a user creates a file, it's their primary group that is associated with it. Secondary groups are those that users might be added to once they already have accounts. Secondary group memberships show up in the /etc/group file.

Run System Settings from a terminal on Ubuntu

gnome-control-center

sudo without password on Linux

run sudo visudo to config. # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # Allow i88ca to execute any command without password i88ca ALL=(ALL) NOPASSWD:ALL # Allow goyun to run ‘/bin/kill’ and ‘systemctl’ commands: goyun ALL = NOPASSWD: /bin/systemctl restart httpd.service, /bin/kill

Keep SSH Connections Alive

/etc/ssh/ssh_config and add the following line to the end of the file: ServerAliveInterval 60 Per user configuration ~/.ssh/config If the file does not exist, this will create a new file. Add the following line: Host * ServerAliveInterval 60

Check MySQL max_connections Value

mysql> SHOW VARIABLES LIKE "max_connections"; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 150 | +-----------------+-------+

Fixed Hyper-V Switch Issues on Windows 10

Disabled Hyper-V, restarted and enabled it again. That made the default switch work.

CSS Grid: auto-fit vs auto-fill

auto-fit works almost identically to auto-fill. The only difference is that when the container's size exceeds the size of all the items combined, auto-fill keeps inserting empty rows or columns and pushes your items to the side, while auto-fit collapses those empty rows or columns and stretches your items to fit the size of the container.

Turn any HTML element into a grid container

Turn any HTML element into a grid container by setting its display property to grid. This gives you the ability to use all the other properties associated with CSS Grid. In CSS Grid, the parent element is referred to as the container and its children are called items.

Share a Web Page in Edge Browser

Open Edge. Tap the Share button on the top right while the page you want to share is open. Press the dropdown arrow next to the page's name to pick the format you wish to share. Select the channel through which you wish to post.

How to screen record on Windows 10

There is a built in screen recorder inside Windows 10. It's there to record your games as you play them. But you can also use it to record content in other windows. But it's only available to machines with certain video cards and it is limited. You can't switch between apps while you're recording, for example; it will only record the window you initially begin capturing. But it's good for the simple stuff. To get the screen capture to work, you need to press Windows button and G together. The controls for the screen recording will be displayed on screen. Once you are finished recording, the video is automatically saved in your video folder, although you can change that in the Game Bar settings.

What is Digital Marketing

Digital marketing is the marketing of goods, products, and services by employing digital technologies found on the internet using devices such as computer, tablets and phones.

Why AI Will Be Game-changer for Digital Marketing

Artificial Intelligence makes it possible for computers to perform tasks that normally require human time and intelligence.

Public cloud vulnerabilities

The leading cloud vulnerabilities Unauthorized cloud access, Insecure interfaces Misconfiguration of the cloud platform Account hijacking

Best affiliate marketing tracking software platforms

According to  Entrepreneur , some of the best affiliate marketing tracking software platforms are Everflow.io, LinkTrust, AffTrack, Hitpath, etc.

An artificial intelligence system created by researchers at the University of California can solve the Rubik's Cube in just over a second.

Fixed: CreateProcessW failed error:2 posix_spawn: No such file or directory

If you encountered this in Windows: ssh uu CreateProcessW failed error:2 posix_spawn: No such file or directory To fix, use a full path. So this is the correct line in the .ssh/config:   ProxyCommand  C:\Windows\System32\OpenSSH\ssh.exe  -q proxy.i88.ca nc %h %p

Fixed: CreateProcessW failed error:2 posix_spawn: No such file or directory

If you encountered this in Windows: ssh uu CreateProcessW failed error:2 posix_spawn: No such file or directory To fix, use a full path. So this is the correct line in the .ssh/config:   ProxyCommand  C:\Windows\System32\OpenSSH\ssh.exe  -q proxy.goyun.info nc %h %p

Chaining multiple SSH proxies

For  A->B->C->D->Internet [hostA]$ ssh -2 -C -D 55557 -L 55556:127.0.0.1:55556 -L 55555:127.0.0.1:55555 user@B [hostB]$ ssh -2 -C -D 55556 -L 55555:127.0.0.1:55555 user@C [hostC]$ ssh -2 -C -D 55555 user@D Note that for each hop, you need an additional matching forwarder  -L  on the previous hosts in the chain. References: ssh tunnel via multiple hops This posting shows how to chain an arbitrary number of proxies:  http://sophiedogg.com/ssh-proxy-through-multiple-servers/ The template for this solution:  http://sysextra.blogspot.com/2013/10/multi-hop-ssh-socks-proxy.html How can I use SSH with a SOCKS 5 proxy? http://www.jethrocarr.com/2013/03/13/ssh-via-socks-proxies/

Debug a perl program

To debug a perl program, invoke the perl debugger using "perl -d" as shown below. # perl -d ./ perl_example.pl

Python email by smtplib and MIMEMultipart example

""" The first step is to create an SMTP object, each object is used for connection with one server. """ import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText server = smtplib.SMTP( ' smtp.i88.ca ' , 587 ) # debug server.set_debuglevel( 1 ) # or server.set_debuglevel(True) # show communication with the server # TLS server.starttls() # Next, log in to the server server.login( " user-name " , " password " ) me = " sender@i88.ca " you = " recipient@i88.ca " # Send the mail msg = MIMEMultipart( ' alternative ' ) msg[ ' Subject ' ] = " Test example " msg[ ' From ' ] = me msg[ ' To ' ] = you html = ' <html><body><p>Hi, I have the following contents for you!</p></body></html> ' part2 = MIMEText(html, ' html ' ) # or part2=MIMEText(text, 'plain') msg.attach(p

Python email by smtplib and MIMEMultipart example

""" The first step is to create an SMTP object, each object is used for connection with one server. """ import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText server = smtplib.SMTP( ' smtp.goyun.info ' , 587 ) # debug server.set_debuglevel( 1 ) # or server.set_debuglevel(True) # show communication with the server # TLS server.starttls() # Next, log in to the server server.login( " user-name " , " password " ) me = " sender@goyun.info " you = " recipient@goyun.info " # Send the mail msg = MIMEMultipart( ' alternative ' ) msg[ ' Subject ' ] = " Test example " msg[ ' From ' ] = me msg[ ' To ' ] = you html = ' <html><body><p>Hi, I have the following contents for you!</p></body></html> ' part2 = MIMEText(html, ' html ' ) # or part2=MIMEText(text, 'plain')

Python email by smtplib example

""" The first step is to create an SMTP object, each object is used for connection with one server. """ import smtplib server = smtplib.SMTP( ' smtp.i88.ca ' , 587 ) # for debug server.set_debuglevel( 1 ) # TLS server.starttls() # Next, log in to the server server.login( " user-name " , " password " ) # Send the mail msg = " \n\n Hello! " # The /n separates the message from the headers server.sendmail( " sender@i88.ca " , " recipient@i88.ca " , msg) server.quit() Python email by smtplib and MIMEMultipart example

Python email by smtplib example

""" The first step is to create an SMTP object, each object is used for connection with one server. """ import smtplib server = smtplib.SMTP( ' smtp.goyun.info ' , 587 ) # for debug server.set_debuglevel( 1 ) # TLS server.starttls() # Next, log in to the server server.login( " user-name " , " password " ) # Send the mail msg = " \n\n Hello! " # The /n separates the message from the headers server.sendmail( " sender@goyun.info " , " recipient@goyun.info " , msg) server.quit() Python email by smtplib and MIMEMultipart example

Fixed Python smtplib.SMTPException: SMTP AUTH extension not supported by server

server = smtplib.SMTP('smtp.i88.ca', 465) server. starttls ()

Fixed Python smtplib.SMTPException: SMTP AUTH extension not supported by server

server = smtplib.SMTP('smtp.goyun.info', 465) server. starttls ()