Skip to content

Instantly share code, notes, and snippets.

View ffosilva's full-sized avatar
:octocat:

Fábio Silva ffosilva

:octocat:
View GitHub Profile
@ffosilva
ffosilva / README.md
Last active February 7, 2025 20:41
Docker Engine on WSL

Docker Engine on WSL2

This tutorial contains instructions to install Docker Engine (not Docker Desktop) on WSL2 distribution. For instance, an Ubuntu 22.04 distribution will be used.

Uninstall any Docker version

Make sure you have fully uninstalled any versions of Docker. The instructions to uninstall can be found here.

Installation, starting and testing

@ffosilva
ffosilva / instructions.md
Last active January 22, 2023 19:16 — forked from matthewjberger/instructions.md
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.local/share/fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache

@ffosilva
ffosilva / postgres_queries_and_commands.sql
Created March 31, 2022 14:10 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'

Setting up a Linux Hyper-V VM on Windows with SGX Support

Note: Hyper-V support for SGX is not yet fully supported, but can be used as a "Preview" with the limitations mentioned below.

To set up a Linux VM on your Windows machine, do the following:

  1. Download an ISO for Ubuntu 18.04 or 16.04. A "Server install image" is sufficient.
  2. Create a VM as follows. Open "Hyper-V Manager", and do Action -> New -> Virtual Machine....
@ffosilva
ffosilva / gerar-grupos.py
Created March 19, 2021 11:19
Generate combinations from groups of numbers
exemplo = [
[1, 2, 3],
[1, 3, 4, 5],
[6, 8, 9, 10],
[12, 13, 15],
[17],
[23, 24]
]
def __next(grupos, pos):
// build using `g++ -fno-elide-constructors rule_of_five.cpp`
#include <stdlib.h>
#include <iostream>
class MyMovableClass
{
private:
int _size;
int *_data;
@ffosilva
ffosilva / ThunderboltUtil.sh
Created January 13, 2021 00:42 — forked from joevt/ThunderboltUtil.sh
A set of functions to examine and modify Thunderbolt DROMs
# by joevt Jul 7, 2020
#=========================================================================================
#
#
# Thunderbolt DROM Notes:
#
#
# https://lore.kernel.org/patchwork/patch/714766/
#
@ffosilva
ffosilva / timelapse.md
Created February 9, 2020 23:00 — forked from alexellis/timelapse.md
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

ffmpeg -r 24 -pattern_type glob -i '*.JPG' -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4

  • -r 24 - output frame rate
  • -pattern_type glob -i '*.JPG' - all JPG files in the current directory
  • -i DSC_%04d.JPG - e.g. DSC_0397.JPG
  • -s hd1080 - 1920x1080 resolution

Slower, better quality

@ffosilva
ffosilva / cacert-gen.sh
Created January 28, 2020 22:51
CA Certificate Issuing helper script
#!/bin/bash
function show_help() {
echo -e "$0 - Generate x509 CA certificate/keys\n"
echo -e "Before start using this script, you should define the following environment variables:"
echo -e "CERT_C - Country Name (C): Use the two-letter code without punctuation for country"
echo -e "CERT_S - State or Province (S): Spell out the state completely; do not abbreviate the state or province name"
echo -e "CERT_L - Locality or City (L): The Locality field is the city or town name"
echo -e "CERT_O - Organization (O): Your company or department"
echo -e "CERT_OU - Organizational Unit (OU): This field is the name of the department or organization unit making the request."
echo -e "CERT_CN - Common Name (CN): The Common Name is the Host Name or Domain Name. Example \"www.domain.com\" or \"domain.com\".\n In Kafka domain, commonly, this field is filled with Kafka username (to use with ACLs)."
@ffosilva
ffosilva / SCRIPT-USAGE.md
Last active January 10, 2020 13:38
Send Pushbullet Script

How to use

Just set PUSHBULLET_TOKEN environment variable with your API token and run:

$ ./send-pushbullet-message.sh "message title" "message content"