This file contains 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
---------------------------------------------------------------------------------------------------------------------------------- | |
Converting a series of jpeg images to a mp4 video: | |
ffmpeg.exe -f image2 -r 3 -i %06d.jpeg -r 15 -vcodec mpeg4 -s 352x240 Camera-0.avi | |
-f image2 => input format | |
-r 3 => input framerate | |
-i %06d.jpeg => input mask (files must be named sequencially, with 6 digits. Ex: "000000.jpeg", "000001.jpeg", "000002.jpeg", etc) | |
-vcodec mpeg4 => video output codec | |
-s 352x240 => resolution |
This file contains 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
sudo -u postgres psql | |
postgres=# create database mydb; | |
postgres=# create user myuser with encrypted password 'mypass'; | |
postgres=# grant all privileges on database mydb to myuser; |
This file contains 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
#Set vim as the default editor (don't forget to check if vim is installed) | |
git config --global core.editor "vim" | |
#Disable pager.branch configuration | |
git config --global pager.branch false | |
#Set user and email | |
git config --global user.name "John Doe" | |
git config --global user.email [email protected] |
This file contains 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
--Challenge: Get the last payment of customer with status = 'CO' | |
--DDL | |
CREATE TABLE `customer` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(100) NOT NULL, | |
PRIMARY KEY (`id`) | |
); | |
CREATE TABLE `payment` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, |
This file contains 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
#Installing GraalVM with SDKMAN (https://sdkman.io/) | |
sdk install java 19.2.1-grl | |
#Installing build tools (C development environment) | |
sudo apt install build-essential libz-dev zlib1g-dev | |
#Configuring GraalVM environment variable | |
#1. Edit global environment file | |
sudo vim /etc/environment |
This file contains 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
import java.util.stream.IntStream | |
fun stair(n: Int) { | |
IntStream.range(1, n).forEach { | |
println(" ".repeat(n - it) + "#".repeat(it)) | |
} | |
} | |
fun main() { | |
print("Enter the stair size: ") |
This file contains 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
kubectl get namespaces | |
kubectl get pods -n <namespace> | |
kubectl logs pod/<pod_name> -n <namespace> | |
kubectl describe pod/<pod_name> -n <namespace> |
This file contains 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
# Reference: https://www.linuxuprising.com/2018/06/fix-no-sound-dummy-output-issue-in.html | |
# Solution 2 fixed my problem (below) | |
echo "options snd-hda-intel dmic_detect=0" | sudo tee -a /etc/modprobe.d/alsa-base.conf | |
echo "blacklist snd_soc_skl" | sudo tee -a /etc/modprobe.d/blacklist.conf | |
# Reboot your system |
This file contains 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
Reference: https://www.raspberrypi.org/forums/viewtopic.php?t=34061 | |
The Pi outputs a relatively weak HDMI signal. Some devices may not immediately notice the Pi's HDMI or may not do the negotiation. | |
Setting the hdmi_force_hotplug=1 makes sure the Pi believes the monitor/TV is really there. | |
You might also need to set config_hdmi_boost=4 or even higher (up to 9) if your display needs a stronger signal. | |
If the display is a computer monitor, use hdmi_group=1 and if it is an older TV, try hdmi_group=2. | |
Do not set hdmi_safe=1 as that overrides many of the previous options. | |
Using a shorter or better quality HDMI cable might help. | |
Make sure your Pi's power supply delivers 1A and not 500mA. | |
If you see a problem with the red colour - either absent, or interference - then try a boost. However it might simply be that the display requires a stronger signal than the Pi can give. |
This file contains 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
import java.time.Duration; | |
import java.time.Instant; | |
public class LongestCommonSubsequence { | |
public int lcsRecursive(char[] a, char[] b, int i, int j) { | |
if (a.length == i || b.length == j) | |
return 0; | |
else if (a[i] == b[j]) | |
return 1 + lcsRecursive(a, b, i + 1, j + 1); | |
else |
OlderNewer