Posts

Showing posts from December, 2020

You should not start a business today without an online presence

You’re unlikely to be successful without a vibrant, mobile-responsive website that launches quickly and navigates smoothly.

The Canadian government recommends people be prepped for at least a 48-hour disaster

How to open zip file in Google Drive on iPhone

Send the zip file as attachment to your Gmail.  Open Gmail App, open the attachment inside the app.

How to open zip file in Google Drive on iPhone

Send the zip file as attachment to your Gmail.  Open Gmail App, open the attachment inside the app.

SpaceX CEO Elon Musk has said any future economy on Mars could be #cryptocurrency based.

Decentralized identity

Decentralized identity can replace identifiers, such as usernames, with IDs that are self-owned, independent, and use blockchain and distributed ledger technology to protect privacy and secure transactions.

The Financial Crimes Enforcement Network (FinCEN)

The Financial Crimes Enforcement Network (FinCEN) prevents and punishes money laundering and related financial crimes. FinCEN tracks suspicious persons and activity by researching mandatory disclosures for financial institutions. The FinCEN receives its duties from Congress and the director of the bureau is appointed by the Treasury Secretary.

Make a password from the command line

$ date | sha256sum e237c08a42a2fbfbb56c1501f23be3c7c5a8ea84ee3a6b952e42f983ca6958e7

A perfect credit score in Canada is a cool 900.

Dell XPS 15 - 15 Inch FHD+, Intel Core i7 10th Gen, 16GB Memory, 512GB Solid State Drive, Nvidia GeForce GTX 1650 Ti 4GB GDDR6, Windows 10 Home (Latest Model) - Silver: Amazon.ca: Computers & Tablets

Enjoy a 16:10 display that features a stunning edge-to-edge view Equipped with 100% Adobe RGB, 94% DCI-P3 color gamut, VESA certified DisplayHDR 400, and Dolby Vision, this display delivers more than 16 million ultra-vivid colors that are 40 times brighter than ever before With a 62% larger touchpad, 5% larger screen, and 5.6% smaller footprint, every element is carefully considered—from its inlayed stainless logos to its high-polished diamond-cut sidewalls Integrated Eyesafe display technology helps reduce harmful blue light Embrace a 3D surround sound experience with more than 7,000 machined speaker holes and a quad speaker design with Waves Nx audio

Java reflection example

Reflection is the ability of a computer program to examine and modify the structure and behavior (specifically the values, meta-data, properties and functions) of an object at runtime. Type Introspection (instanceof) is the ability to inspect the code in the system and see object types. Reflection is then the ability to make modifications at runtime by making use of introspection. The sample code can be download here . output: Hello  goyun.info ! Hello  goyun.info ! Hello it.goyun.info! Use reflection to deal with private property or method such as unit testing: // / For private methods: Method method = targetClass . getDeclaredMethod(methodName, argClasses); method . setAccessible( true ); return method . invoke(targetObject, argObjects); // / And for private fields: Field field = targetClass . getDeclaredField(fieldName); field . setAccessible( true ); field . set(object, value); // The setAccessible(true) is required to play around with privates. Refl...

Start windows terminal automatically

Put  "startOnUserLogin": true to settings.json of the Windows Terminal. Or put wt.exe to your windows startup script.

Run wsl command at startup

Create a bat file to start WSL services in the Windows startup folder Open the Windows startup folder. For that, simply press Windows Key + R to open the Run box and then type shell:startup and press the Enter key. Inside the folder right and create a .bat file, such as example.bat: Put commands you like to run wsl sudo service mysql start wsl sudo service apache2 start aws s3 ls #start windows terminal wt.exe

Launch Windows Terminal

Run wt.exe from anywhere inside Windows.

Send email if and only if there is content

 ifne runs the following command if and only if the standard input is not empty.  Options -n. Reverse operation. Run the command if the standard input is empty. The ifne command is part of the moreutils package. $ sudo yum -y install  moreutils Examples: $ mysql --login-path=goyun mysql -e "select * from user where user='goyuninfo'\G" | ifne mailx -s "User goyuninfo found in mysql" service@goyun.info If you don't want to install ifne, the following is the same: $ output=$(mysql --login-path= goyun  mysql -e "select * from user where user='goyuninfo'\G"); [[ -n "$output" ]] && mailx -s "User goyuninfo found in mysql"  service@goyun.info Reverse:  $ mysql --login-path= goyun  mysql -e "select * from user where user='goyuninfo'\G" | ifne  -n  mailx -s "User goyuninfo not found in mysql"  service@goyun.info Null message body; hope that's ok

Run command if stdin is not empty on Linux

ifne runs the following command if and only if the standard input is not empty.  Options -n. Reverse operation. Run the command if the standard input is empty. The ifne command is part of the moreutils package. $ sudo yum -y install  moreutils Example usage: Send email if and only if there is content: $ mysql --login-path=goyun mysql -e "select * from user where user='goyuninfo'\G" | ifne mailx -s "User goyuninfo found in mysql" service@goyun.info If you don't want to install ifne, the following is the same: $ output=$(mysql --login-path= goyun  mysql -e "select * from user where user='goyuninfo'\G"); [[ -n "$output" ]] && mailx -s "User goyuninfo found in mysql"  service@goyun.info Reverse:  $ mysql --login-path= goyun  mysql -e "select * from user where user='goyuninfo'\G" | ifne -n mailx -s "User goyuninfo not found in mysql"  service@goyun.info Null message body; hope that...

Use specific SSH key for git clone

$ git clone your-git-repository-URL --config core.sshCommand="ssh -i ~/location/to/private_ssh_key"

nvm offers quite a few options to set up, update, and manage Node.js.

To install nvm, run the following commands inside the Linux terminal: wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash source .bashrc

Run Linux apps on Chromebook

Linux (Beta) on Chrome OS, sometimes called Crostini, allows you to run Linux apps for development alongside your usual Chrome OS desktop & apps. Linux (Beta) on Chromebooks offers developers the best of both worlds. Built and designed with Chrome OS' principles of simplicity and security, Linux on Chromebooks gives devs the freedom to safely run their favorite editors, IDEs, and thousands of world-class dev tools in one container. VS Code runs on any recent Chromebook, as long as you are able to enable Linux applications via Crostini.

GVim Portable is a powerful, feature-rich and highly configurable text editor primarily for programming.

With GVim you can efficiently write code with syntax highlighting in many languages, and many other useful features like regular expression search and replace. 

Check If File Is Empty OR Not by Bash Script

How to get the self script file name in a Bash script?

[ec2-user@dockers ~]$ cat ~/test.sh echo $BASH_SOURCE # get file name only without path echo $(basename $BASH_SOURCE) [ec2-user@dockers ~]$ bash ~/test.sh /home/ec2-user/test.sh test.sh [ec2-user@dockers ~]$ ~/test.sh /home/ec2-user/test.sh test.sh [ec2-user@dockers ~]$ ./test.sh ./test.sh test.sh [ec2-user@dockers ~]$

How to prepend to a Linux file

How to insert line to the beginning of file on Linux $ sed '1 s/^/This is the line to prepend\n/' file-to-be-prepended Modify in place: $ sed  -i '1 s/^/This is the line to prepend\n/' file-to-be-prepended

#Docker container operations

To start the container named goyuninfo: docker start goyuninfo To stop and start again the container with a single command: docker restart goyuninfo To delete the container, stop it first, and then use the docker rm command: docker stop goyuninfo docker rm goyuninfo 

Create a database in a Docker container for local development

Start a Docker Container $ docker run --name=goyuninfo --restart on-failure -d mysql/mysql-server Connecting to MySQL Server from within the Container Get initial root password: $ docker logs goyuninfo 2>&1 | grep GENERATED [Entrypoint] GENERATED ROOT PASSWORD: 5EjdAv(ucryHFyg3dOv,AmgUnZ $ docker exec -it goyuninfo  mysql -uroot -p Because the MYSQL_ONETIME_PASSWORD option is true by default, after you have connected a mysql client to the server, you must reset the server root password by issuing this statement: mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'your-new-password'; mysql> flush privileges; If you want to pipe data into one of the command line tools, such as loading a dump, you will need to remove the -t from the command line, like this: docker exec -i goyuninfo  mysql -uroot < dumpfile.sql Set up TCP/IP access to Docker containers Find out the IP address of your virtual network interface on your Linux machine: [ec2-user@ip-172-1...

Get a timestamp in #JavaScript

On almost all current browsers you can use Date.now() to get the UTC timestamp in milliseconds; To get the timestamp in seconds, you can use: Math.floor(Date.now() / 1000) > Date.now() 1608669466244 > Math.floor(Date.now() / 1000) 1608669474

Compose is a tool for defining and running multi-container Docker applications

With Compose, you use a YAML file to configure your application's services. Then, with a single command, you create and start all the services from your configuration. Multiple isolated environments on a single host Preserve volume data when containers are created Only recreate containers that have changed Variables and moving a composition between environments https://docs.docker.com/compose/#features The following example shows how to get the docker-compose version. [ec2-user@ip-172-16-0-86 ~]$ docker-compose -version docker-compose version 1.27.4, build 40524192

FTC Approves Final Amendments to the Energy Labeling Rule

Updates create consumer EnergyGuide labels for portable air conditioners Following a public comment period, the Federal Trade Commission has approved a Federal Register notice (FRN) announcing final amendments to the agency’s Energy Labeling Rule (Rule). The final amendments establish EnergyGuide labels for portable air conditioners (AC) and update the energy efficiency descriptors for central AC units. They require manufacturers to label portable AC units produced after October 1, 2022. The Rule, issued in 1979 under the Energy Policy and Conservation Act, requires energy labeling for major home appliances and other consumer products to help consumers compare the energy usage and costs of competing models. The Rule requires manufacturers to attach yellow EnergyGuide labels to many of the products it covers and prohibits retailers from removing or altering these labels. In a FRN announced in March 2020 , the FTC proposed establishing EnergyGuide labels for portable AC units. The Commi...

Check if File Empty or Not on Linux

#!/bin/bash   if [ -s /path/to/myfile.txt ] then      echo "File is not empty" else      echo "File is empty" fi

FTC Data Show Gift Cards Remain Scammers’ Favorite Payment Method

Agency to roll out new materials for retailers to help combat gift card scams A new data analysis  by the Federal Trade Commission shows that gift cards continue to be the most common form of payment when consumers report losing money to most scammers. Since 2018, the data analysis shows consumers have reported spending nearly $245 million on gift cards that they used to pay scammers for a wide variety of scams. Most often, consumers that use gift cards to pay a scammer are drawn in by an imposter scam. These can take on many forms, but the ones most likely to rely on gift cards as a payment method were government imposters, family imposters, business imposters, and tech support scams. In these scams, the scammers convince consumers that they must pay using gift cards. The reasons they present vary, but they always come back to the idea that a consumer must go to a retail outlet, purchase physical gift cards, and then provide the PIN numbers on the cards to the scammer. Reports sugges...

SpaceVim A community-driven vim distribution

SpaceVim is a distribution of the Vim editor that's inspired by spacemacs. It manages collections of plugins in layers, which help collecting related packages together to provide features. For example, the lang#python layer collects deoplete.nvim, neomake and jedi-vim together to provide autocompletion, syntax checking, and documentation lookup. This approach helps keeping configuration organized and reduces overhead for the user by keeping them from having to think about what packages to install. https://spacevim.org/

Fixed #docker: bash: dnf: command not found

bash-4.4# dnf -y update bash: dnf: command not found bash-4.4# microdnf -y update Use microdnf inside docker instead.

authenticate to GitHub Packages with Docker using the docker login

$ cat ~/TOKEN.txt | docker login https://docker.pkg.github.com -u USERNAME --password-stdin WARNING! Your password will be stored unencrypted in /home/ec2-user/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.

A major strength of LLVM is its versatility, flexibility, and reusability, which is why it is being used for such a wide variety of different tasks: everything from doing light-weight JIT compiles of embedded languages like Lua to compiling Fortran code for massive super computers. https://llvm.org/

WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine.

Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications. https://webassembly.org/

Emscripten is a complete Open Source compiler toolchain to WebAssembly.

Using Emscripten you can: Compile C and C++ code, or any other language that uses LLVM, into WebAssembly, and run it on the Web, Node.js, or other wasm runtimes. Compile the C/C++ runtimes of other languages into WebAssembly, and then run code in those other languages in an indirect way (for example, this has been done for Python and Lua). https://emscripten.org/docs/introducing_emscripten/about_emscripten.html

Emscripten Compiler Frontend (emcc)

Emscripten Compiler Frontend (emcc) The Emscripten Compiler Frontend (emcc) is used to call the Emscripten compiler from the command line. It is effectively a drop-in replacement for a standard compiler like gcc or clang. Command line syntax emcc [options] file... https://emscripten.org/docs/tools_reference/emcc.html

Emscripten is an LLVM-based compiler

Emscripten is an LLVM-based compiler that can generate either WebAssembly or a subset of JavaScript known as asm.js, primarily for execution in web browsers. Emscripten allows applications and libraries written in languages other than JavaScript to be compiled ahead of time and run efficiently in web browsers, typically at speeds comparable to or faster than interpreted or dynamically compiled JavaScript.

GraalVM allows you to call one programming language into another and exchange data between them.

To enable interoperability, GraalVM provides the --polyglot flag. GraalVM allows users to write polyglot applications that seamlessly pass values from one language to another. Truffle is a Java library for building programming languages implementations as interpreters for self-modifying Abstract Syntax Trees. When writing a language interpreter with Truffle, it will automatically use the GraalVM compiler as a just-in-time compiler for the language. 

GraalVM’s /bin directory is similar to that of a standard JDK

GraalVM’s /bin directory includes a set of additional launchers: js a JavaScript launcher node a Node.js launcher lli a LLVM bitcode launcher gu the GraalVM Updater tool to install additional language runtimes and utilities

GraalVM’s polyglot capabilities make it possible to mix multiple programming languages in a single application while eliminating any foreign language call costs.

GraalVM is a new universal virtual machine

GraalVM is a new universal virtual machine from Oracle that supports a polyglot runtime environment and the ability to compile Java applications down to native machine code. http://www.graalvm.org/

Data Structures - Computer Science Course for Beginners

Image

Linux – Auto-Reboot and Shutdown with Cron Jobs

[ec2-user@ip-172-16-0-86 ~]$ sudo crontab -l 58 22 * * * root      /sbin/shutdown -h now # shutdown every night [ec2-user@ip-172-16-0-86 ~]$

Twilio Authy is the preferred two factor authentication solution to protect your bitcoin wallet.

Changing Linux username

Linux user name can be changed whenever a user feels to do so.  You can do so via the command line using the usermod command. Syntax: usermod -l [new username] [existing username] sudo usermod -l goyun awikica You can confirm the username change by running the id [user] command command.

Removing All Unused Docker Objects

The docker system prune command removes all stopped containers, dangling images, and unused networks: docker system prune If you want to remove all unused images not just the dangling ones, add the -a (--all) option to the command: docker system prune -a

FTC Announces Crackdown on Deceptively Marketed CBD Products

Image
Companies made unsupported claims that their oils, balms, gummies, coffee, and other goods could treat serious diseases such as cancer and diabetes Note: The FTC will host a media call-in on this announcement with Andrew Smith, Director, Bureau of Consumer Protection Date: Thursday, December 17, 202 Time: 11:00 a.m. ET Call-in: 844-291-6360; Access Code: 389969 Call-in lines, which are for media only, will open 15 minutes prior to the start of the call. The Federal Trade Commission today announced the first law enforcement crackdown on deceptive claims in the growing market for cannabidiol (CBD) products. The FTC is taking action against six sellers of CBD-containing products for allegedly making a wide range of scientifically unsupported claims about their ability to treat serious health conditions, including cancer, heart disease, hypertension, Alzheimer’s disease, and others. The FTC is requiring each of the companies, and individuals behind them, to stop making such unsupporte...

Google is delaying its return-to-office date for most of its staff to September 2021

Google is also exploring the idea of making remote work a permanent fixture — at least for a few days a week. 

The J2EE and .NET platforms provide developers the ability to limit the capabilities of code running inside of their virtual machines.

Web applications often run in environments with AllPermission (Java) or FullTrust (.NET) turned on.  This limits the ability of the virtual machine to control the actions of code running under its control. Implementing code access security measures is not only useful for mitigating risk when running untrusted code – it can also be used to limit the damage caused by compromises to otherwise trusted code.

Bots can cause massive problems for web properties.

Undetected malicious bots can impact your revenue. Bad actor bots can take over accounts, scrape or download content from a website, and hoard inventory. Too much bot traffic can put a heavy load on web servers, slowing or denying service to valuable traffic.

FTC Issues Call for Research Presentations for PrivacyCon 2021

Image
The Federal Trade Commission issued a call for research on a wide range of privacy and security issues as part of its sixth annual PrivacyCon event, which will take place July 27, 2021. PrivacyCon 2021 will bring together a diverse group of stakeholders, including researchers, academics, industry representatives, consumer advocates, and government regulators, to discuss the latest research and trends related to consumer privacy and data security. The FTC is seeking empirical research and demonstrations on such issues as: The nature and evolution of privacy and security risks; Privacy and security issues related to working from home; The costs and benefits of privacy and security; Effectiveness of consumer privacy and security disclosures: Algorithmic bias and ensuring fairness in algorithmic use; and Privacy-enhancing technologies for consumers. More details and information on how to submit presentations can be found on the event page .   The deadline for submitting...

Installing MySQL Enterprise Audit

location of audit_log_filter_linux_install.sql /usr/share/mysql/audit_log_filter_linux_install.sql mysql> source /usr/share/mysql/audit_log_filter_linux_install.sql

Grant the SUPER privilege to a MySQL user account

To grant the SUPER privilege to a MySQL user account, use this statement: GRANT SUPER ON *.* TO user;

Mortgage Analytics Company Settles FTC Allegations It Failed to Ensure Vendor Was Adequately Protecting Consumer Data

A mortgage industry data analytics company will be required to implement a comprehensive data security program as part of a settlement resolving Federal Trade Commission allegations that the firm failed to ensure one of its vendors was adequately securing personal data about tens of thousands of mortgage holders.  In its complaint , the FTC alleged that Texas-based Ascension Data & Analytics, LLC violated the Gramm-Leach Bliley Act’s Safeguards Rule , which requires financial institutions to develop, implement, and maintain a comprehensive information security program. As part of that program, financial institutions must oversee their third-party vendors, by ensuring they are capable of implementing and maintaining appropriate safeguards for customer information, and requiring them to do so by contract. The FTC alleged that Ascension failed to do this. “Oversight of vendors is a critical part of any comprehensive data security program, particularly where those vendors can put sens...

This Morning: FTC, Federal and State Partners to Announce Major Law Enforcement Sweep

The Federal Trade Commission, in conjunction with federal and state partners, will announce a major consumer protection law enforcement sweep on a teleconference TODAY at 11 a.m. FTC Bureau of Consumer Protection Director Andrew Smith and Maryland Attorney General Brian Frosh will give remarks and answer questions from the media. WHAT: A phone-in press conference to announce a major consumer protection law enforcement sweep by the FTC and federal, state, and local partners. WHO: FTC Bureau of Consumer Protection Director Andrew Smith and Maryland Attorney General Brian Frosh will give remarks and answer questions from reporters. WHEN: Today, 11 a.m. ET WHERE: Via teleconference. Members of the media may dial in to the press conference by dialing 844-291-6360. Access code: 389969. Lines for media will open 15 minutes before the start of the press conference. The Federal Trade Commission works to promote competition and to protect and educate consumers . You can learn more about consum...

Azure AD Multi-Factor Authentication

Azure AD Multi-Factor Authentication works by requiring two or more of the following authentication methods: Something you know, typically a password. Something you have, such as a trusted device that is not easily duplicated, like a phone or hardware key. Something you are - biometrics like a fingerprint or face scan.

Run Linux Apps On Your Chromebook With Crostini

Open the Settings menu Scroll down to find Linux (Beta), then turn the option on Follow the on-screen instructions.  Once Linux finishes installing, a Linux terminal will appear. Update the Linux installation using the sudo apt update command, then sudo apt update upgrade On completion, open your Chrome browser and type chrome://flags. Type crostini in the Flags search bar, then search for the Crostini GPU Support Switch it to Enabled. After you complete the Linux (Beta) and Crostini installation, you can install Linux packages to your Chromebook. 

Create A Chromebook Recovery

Download Chromebook Recovery Utility from the Chrome Web Store. Use the app to download a copy of Chrome OS onto a removable media with 4GB storage.

No Modification to Blockchain

In a normal database, any data can be changed, updated, or deleted. Blockchain is different: only new information can be added. By its design, existing information can never be updated or deleted.

AWS Lambda can connect to an AWS hosted databases such as RDS or DynamoDB.

 AWS Lambda can also connect to external databases which are public or grant network access. 

Fixed: You asked to pull from the remote 'origin', but did not specify a branch. Because this is not the default configured remote for your current branch, you must specify a branch on the command line.

Encounter: You asked to pull from the remote 'origin', but did not specify a branch. Because this is not the default configured remote for your current branch, you must specify a branch on the command line. You have to tell git which branch you want to pull from the "origin" remote repos. Change to git pull origin master Or another branch.

Enabling Java Flight Recorder

Launch your Java application with the -XX:+FlightRecorder option along with commercial features using the -XX:+UnlockCommercialFeatures options. For example, to enable JFR when launching a Java application named GoYunApp, use the following command: java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder GoYunApp

Change a service startup type by PowerShell

Set-Service –Name theservice –Computer thecomputer –StartupType “selectedType” Where selectedType value can be: Automatic Manual Disabled

How to remove powered by Blogger attribution.

Go to Blogger.com and login to your Blogger profile. Select your blog that you wish to remove this attribute. Now go to template and click edit HTML. Here drop-down “ jump to widget ” option and from that list select Attribution1 as highlighted below. Now in the editor press ctrl + F and find for this line <b:widget id=’Attribution1′ locked=’true’ title=” type=’Attribution’>. Now replace the locked=’ true ’ in to locked='false', visible='false'. Once done click save template.

Set Up Multi-Factor Authentication for SSH on Amazon/Oracle Linux/CentOS/Fedora

Step 1 — Installing Google’s PAM $ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm $ sudo yum install google-authenticator Run the initialization app. $ google-authenticator Once you finish this setup, if you want to back up your secret key, you can copy the ~/.google-authenticator file to a trusted location. From there, you can deploy it on additional systems or redeploy it after a backup. Step 2 — Configuring OpenSSH and Making SSH Aware of MFA Edit  /etc/pam.d/sshd Append the last line to the bottom of the file: # Used with polkit to reauthorize users in remote sessions -session optional pam_reauthorize.so prepare auth required pam_google_authenticator.so nullok The nullok word at the end of the last line tells the PAM that this authentication method is optional. This allows users without a OATH-TOTP token to still log in using their SSH key. Once all users have an OATH-TOTP token, you can remove nullok from this line to make MFA man...

Running Docker inside Ubuntu with WSL2 on Windows 10

Enable Docker for Ubuntu on Windows via WSL2: Go to Docker Desktop > Settings > Resources > WSL Integration Make sure you have “Enable integration with my default WSL distro” selected and also turn on each distro. Now you can launch Ubuntu and without even installing “docker” in Ubuntu you should be able to run the “docker” command: $ docker ps -a CONTAINER ID   IMAGE                                                         COMMAND                  CREATED      STATUS                       PORTS     NA MES 7b5806fcd967   vsc-vscode-remote-try-java-7082d7a76a508a754975227521a1e638   "/bin/sh -c 'echo Co…"   5 days ago   Exited (255) 2 minutes ago  ...