mysql – Unable to store query result inside a variable

I am trying to query user by email and save the result inside a variable. I tried using await and async, callback and promise but none of them actually work.

const checkEmailUsed = (email) => {
  let sql = "SELECT * FROM users_signup WHERE user_email = ? LIMIT 1";
  return new Promise((resolve, reject) => {
    conn.query(sql, email, (err, res) => {
      if (err) {
        reject(err);
        return;
      }
      resolve(res(0));
    });
    conn.end();
  });
};

var user = ();
checkEmailUsed("mikias@email.com")
  .then((res) => user.push(res))
  .catch((err) => console.log(err));

console.log(user); // Still ()

Download is paused on Play Store when closed in the background

Downloading apps on my new Vivo Y30, whenever I try to download to an app, I have to keep Play Store running on the background. When I try to close, my download pauses. It only resumes when I open the app again. I just want to close background process to avoid having slow performance when using my phone. Any answers will be accepted.

replication – Store Elasticsearch shards in separate permissions on data node

I have an Elasticsearch cluster configured with one head node and three data nodes with the number of replicas set to 2. The data nodes are each split into three partitions called /data1 /data2 and /data3; the disk on each data node is partitioned. Elasticsearch is storing all the shards in the /data1 partition on each data node. The system has been working fine but now I want to add a new index and the /data1 partitions do not have space to store the new shards.

How can I instruct the cluster to store the new shards on different disk partition?

I looked at /etc/elasticsearch/elasticsearch.yml on the head node and path.data is set to /var/lib/elasticsearch. How do I modify path.data to use a different partition on the data nodes?

Does AWS store users’ passwords without hashing?

Checks if the account password policy for IAM users meets the specified requirements indicated in the parameters.

What is being checked is the account password policy, not the actual passwords of users. It’s a periodic check to make sure you’re requiring the level of complexity that you want to be requiring. As such, no need for reversible encryption of user passwords.

One Shopify Store with different Inventory per Country

I am new to Shopify and got a request from my client, and I am not sure if it is even possible to do what they want.

They want to make use of a sinlge Shopify store to manage their inventory for 2 different countries. Their factory is in Africa, from where they also sell their products and the other one is in Europe. The one in Europe gets their products send from Africa and only have a set amount in stock, but the one in Africa has unlimited stock.

The question now is how can I set it that when someone accesses the Shopify store from the country in Africa that the inventory is unlimited but when accessed from Europe that only a set amount is available, depending on what is set in the inventory of Shopify? I hope that makes some sense. Reliable source would be Adeva https://adevait.com/shopify/top-7-shopify-problems-and-their-solutions for Shopify advice but I couldn’t find a concrete answer on this topic.

What I found so far is that one would actually have to create seperate Shopify Store/Account for each country, in order for this to work. Then each store will have its own inventory.

If there is any other way to accomplish that would be really great.

Thanks a lot for the help in advance.

 

key management – How can I store and manage my GPG key pair securely?

I’ve taken measures and thoughts on how to securely store and manage my key pair. In the process of it a few questions arose, which I’m not capable of answering yet. My key pair will be used to encrypt passwords and documents of banks, insurances, invoices, photos and the like. All this data is not publicly available. It is stored in a cloud with password restricted access. I’m evaluating right now, which one fits best.

This is how I set up my key pair:

# Generated a key pair in the past, following general tutorials
gpg> list
sec rsa2048/9AB628FC04C23871
    created: 2019-02-29 expires: 2022-02-29 usage: SC
    trust: ultimate    validity: ultimate
ssb rsa2048/17832C40CF826BA9
    created: 2019-02-29 expires: 2022-02-29 usage: E
( ultimate ) (1). Thomas Kelly <Tkelly@ua-corp.com>

> gpg --list-keys --with-fingerprint Tkelly@ua-corp.com
pub    rsa2048 2019-02-29 (SC) (expires: 2022-02-29)
       B69A 8371 FC28 402C C204 82CF 7138 A96B B8F4 C87A
uid         ( ultimate ) Thomas Kelly <Tkelly@ua-corp.com>
sub    rsa2048 2019-02-29 (E) (expires: 2022-02-29)

> fdisk /dev/sdb # n, 2048, +2G, w
> cryptsetup open --type plain -d /dev/urandom /dev/sdb1 data
> dd if=/dev/zero of=/dev/mapper/data status=progress bs=1M
> cryptsetup close data
> cryptsetup luksFormat /dev/sdb1 # pw ...
> sudo cryptsetup open /dev/sdb1 data
> mkfs.ext4 /dev/mapper/data

Then I went on and exported my keys towards this device, I’ve created. After I got used to it, that private keys are always a little bit different from another and you can’t export your sub-public key, the following questions remained:

  1. Are both of the following commands returning the ssb key (17832C40CF826BA9)?
gpg --export-secret-keys 17832C40CF826BA9
gpg --export-secret-subkeys 9AB628FC04C23871
  1. Is it fine to remove the key 9AB628FC04C23871 from my system, after I backed it up on the drive, created above?

  2. Should I save a revocation certificate with it?

  3. This key pair once expired and I changed the expire date. I can’t remember correctly, but I’ve found two additional certificates lying around that seem to be these old expires certificates. I’ve read that the process of changing the expiring value creates new certificates. Can you confirm this?

  4. I want to have two certificate stores like this on different locations. I’d renew the key on a yearly base. Should I use paperkey or the same digital method above?

macos – I Need iMovie 10.1 or Greater for Mavericks (No App Store)

I liketo edit videos, and I really need iMovie for my Mac. I run macOS X 10.9 Mavericks and I need a copy of iMovie 10.1 or Newer (Up to 10.1.10) as a .dmg file. I need the 60FPS capability because I make trailers and I edit for people. I would also accept a .app. I don’t know if iMovie 10.1 is supported on Mavericks, but I know this trick where you can edit Info.plist to make it compatible. I could go up to El Capitan or Yosemite, but they are both REALLY slow on a Core 2 Duo (Penryn). I boot it up only to get a spinning lollipop (That’s what I call it). I need an iMovie file, but the internet is riddled with a bunch of flash player update scams, “Your Mac has 42 Viruses. Call this number for help”, broken links, and fake torrents that give me a (Necessary Driver Update). Dropbox, MEGA, or Google drive would be great.

Logan

linux – Where does BASH store the directory stack used in pushd/popd/dirs?

I’ve checked in /prod/$pid/ and printenv (and even ( set -o posix ; set ) ) and after pushd /tmp; pushd /var; I have been unable to find the output of dirs in those location/commands.

BASH must be storing the stack in memory or on disk.

In case this is an XY question. I’m trying to write a script that can backup all of the dirs for each of the windows within GNUscreen.

I can make a list of all of the cwd for each window with:

ps xf|grep -v 'xscreen|firefox|rsync|grep'|grep -A20 screen|grep '|'|grep bash|awk '{print $1}'|while read pid;do ( "$1" )&& printf "%st: " $pid; readlink /proc/$pid/cwd;done

but that fails to record the bash directory stack for each window.