Assuming you already have an application deployed to Google App Engine with a custom domain. Now you want to add https with certificates generated from Let's Encrypt. Here are the steps on how to do it.
(1) Setup your Let's Encrypt client: git clone https://github.com/letsencrypt/letsencrypt
(2) Generate the certificate. For example, to get a certificate for www.acme.com: sudo ./letsencrypt-auto certonly --manual -d www.acme.com
Answer a few questions and the script will pause. You will then need to upload a validation file to www.acme.com to confirm that you indeed own the domain.
Create a file containing just this data: _Pwd8uL9_Joz0O2HNlbyb5nBnrcqvmGj02gX2PfJYhw.XOAQHxnBJFCW1KHWhsYsaRmc_BaKnwNpuNYbS8o2gdY And make it available on your web server at this URL: http://www.acme.com/.well-known/acme-challenge/_Pwd8uL9_Joz0O2HNlbyb5nBnrcqvmGj02gX2PfJYhw ------------------------------------------------------------------------------- Press Enter to Continue
(3) Create and upload the file to App Engine. Create the folder .well-know/acme-challenge in your application tree. Then create the specified file and content. In this example, the file name is _Pwd8uL9_Joz0O2HNlbyb5nBnrcqvmGj02gX2PfJYhw
and the content is _Pwd8uL9_Joz0O2HNlbyb5nBnrcqvmGj02gX2PfJYhw.XOAQHxnBJFCW1KHWhsYsaRmc_BaKnwNpuNYbS8o2gdY
In your app.yaml file, include the /.well-know folder as static content:
(4) (Optional) Test the URL with your browser that the validation file is deployed successfully.
(5) Go back to the console where the Let's Encrypt client is paused. Press Enter to continue the execution. If everything worked out, the certificate and private key will be generated.
(6) Deploy the certificate to GCP. In your browser, go to the GCP console > App Engine > Settings. Select "SSL certificates". Click "Upload a new certificate".
Dump the content of the certificate and paste it in the text area: sudo cat /etc/letsencrypt/live/www.acme.com/fullchain.pem
For the private key, you will need to convert the format to RSA before pasting: sudo openssl rsa -in /etc/letsencrypt/live/www.acme.com/privkey.pem
Finally, check the box to enable this certificate with your custom domain.
In order to have Tumbleweed GUI working on Kabini, one needs to install the kernel-firmware package.
Recently moved my Linux workstation to an old AMD APU platform with Kabini (Athlon 5350). The installation completed successfully, but the console goes blank and X cannot use the radeon driver and fallback to VESA.
After some digging, found that although the radeon and amdgpu modules are loaded, there are error messages in dmesg saying that some firmwares cant be loaded.
The problem can be easily fixed by installing the kernel firmware:
Shrinking the dynamic storage file of VirtualBox used to be tedious. First need to zero out the free space in the guest and then compacting the file from host.
With Linux supporting TRIM and VirtualBox supporting DISCARD, it can be done much easier within the guest.
First, on the host, prepare the storage file with DISCARD support:
VBoxManage storageattach "Ubuntu server" --storagectl "SATA" --port 0 --discard on --nonrotational on
- "Ubuntu server" is the VM name
- use "--storagectrl" and "--port" to specify the storage controller
Then whenever the storage file needs to be compacted, execute fstrim in the guest. e.g.
public static Stream<BigInteger> stream() {
return Stream
.iterate(
BigInteger.ONE,
i -> i.add(BigInteger.ONE))
.map(i -> i.multiply(i.add(BigInteger.ONE)).divide(TWO));
}
And a Stream for Fibonacci sequence.
public static Stream<BigInteger> stream() {
return Stream
.iterate(
new BigInteger[] { BigInteger.ONE, BigInteger.ONE },
p -> new BigInteger[] { p[1], p[0].add(p[1]) })
.map(p -> p[0]);
}
Now, a simple and naive way to test for a triangular Fibonacci number is to loop the Fibonacci sequence while testing for the number's existence in the stream of triangular numbers.
Iterator<BigInteger> fib = FibonacciNum.stream().limit(TEST_LIMIT).iterator();
Iterator<BigInteger> tri = TriangularNum.stream().iterator();
BigInteger t = tri.next();
List<BigInteger> result = new ArrayList<BigInteger>();
while (fib.hasNext()) {
BigInteger f = fib.next();
while (t.compareTo(f) <= 0) {
if (t.equals(f)) {
result.add(t);
}
t = tri.next();
}
}
But since the Fibonacci sequence grows so quickly, it is a waste of CPU time to generate all those triangular numbers. A quicker way is to ditch the triangular number stream and implement a test function for triangular number. We then use that function to filter the Fibonacci stream.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Upgraded my Tumbleweed to kernel 4.10.x and Nvidia 340 driver won't build. Until Nvidia fix it, here are steps to patch the 340.102 driver to make it works.
Proceed to install. Note that the unified memory module can't be built with this patch, so we are disabling it: sudo ./nvidia-installer --no-unified-memory
Here is another experiment with OpenCV face detection and recognition. Full source code is available on GitHub.
The picture below is the recognition program running on my Windows laptop and the webcam is feeding live images to the program. My phone is in front of the webcam showing a photo.
The face recognizer was trained with ~10 photos each for Obama, Trump, and Trudeau that I found on internet.
To increase the accuracy, a simple transformation step was added to level the face images when training the recognizer.