Skip to content

Instantly share code, notes, and snippets.

View lbbedendo's full-sized avatar

Leonardo Barbieri Bedendo lbbedendo

View GitHub Profile
@lbbedendo
lbbedendo / gist:c4b15372fd5fc490d46d2cb9e7cf533b
Last active December 7, 2021 00:37
ffmpeg and ffprobe commands
----------------------------------------------------------------------------------------------------------------------------------
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
@lbbedendo
lbbedendo / gist:53078df4d17f04f34cfd5c0f7793c60a
Created October 8, 2019 13:47
Creating user, database and adding access on PostgreSQL
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;
@lbbedendo
lbbedendo / git_config.sh
Last active October 8, 2019 13:57
Git useful commands and configs
#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]
@lbbedendo
lbbedendo / sql_challenge_customers_payments.sql
Created December 2, 2019 20:37
sql challenge - customers and payments
--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,
@lbbedendo
lbbedendo / gist:99fc27d05405cd517ebaa03f7ea67e87
Created December 13, 2019 16:16
Configuring GraalVM in Ubuntu 18.04
#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
@lbbedendo
lbbedendo / staircase.kt
Created December 18, 2019 12:55
staircase
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: ")
@lbbedendo
lbbedendo / kubectl.txt
Last active March 3, 2020 18:06
Kubectl commands
kubectl get namespaces
kubectl get pods -n <namespace>
kubectl logs pod/<pod_name> -n <namespace>
kubectl describe pod/<pod_name> -n <namespace>
@lbbedendo
lbbedendo / audio_fix_dummy_output.sh
Last active November 8, 2020 17:27
Audio fix for ubuntu 19.10 on Dell G3 3590 (Dummy Output)
# 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
@lbbedendo
lbbedendo / raspberrypi_hdmi_signal.txt
Last active April 25, 2020 14:00
raspberry pi hdmi signal
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.
@lbbedendo
lbbedendo / LongestCommonSubsequence.java
Last active May 13, 2020 00:28
Longest Common Subsequence in java
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