Skip to content

Instantly share code, notes, and snippets.

View Dpbm's full-sized avatar
:shipit:
hello there!

Alexandre Dpbm

:shipit:
hello there!
View GitHub Profile
@Dpbm
Dpbm / CMakeLists.txt
Created May 12, 2024 17:13 — forked from fracek/CMakeLists.txt
CMake and GTK+ 3
# Thanks to @danger89 and @Ilothar for updating the gist.
# Set the name and the supported language of the project
project(hello-world C CXX)
# Set the minimum version of cmake required to build this project
cmake_minimum_required(VERSION 3.10)
# Use the package PkgConfig to detect GTK+ headers/library files
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED gtkmm-3.0)
@Dpbm
Dpbm / circle-drawing.c
Created May 6, 2024 00:28 — forked from wldomiciano/circle-drawing.c
Drawing a normal and filled circle with SDL 2
#include <SDL.h>
SDL_Window* window;
SDL_Renderer* renderer;
void drawCircle(int xc, int yc, int x, int y) {
SDL_RenderDrawPoint(renderer, xc + x, yc + y);
SDL_RenderDrawPoint(renderer, xc - x, yc + y);
SDL_RenderDrawPoint(renderer, xc + x, yc - y);
@Dpbm
Dpbm / compiling_asm.md
Created January 21, 2024 23:19 — forked from yellowbyte/compiling_asm.md
how to assemble assembly with NASM assembler to 32-bit or 64-bit ELF binary with or without libc

32-bit ELF binary

how to assemble and link:

nasm -f elf32 -o <filename>.o <filename>.asm
ld -m elf_i386 -o <filename> <filename>.o

template code (hello world):

section .text
global _start
logica --> nos permite validar e construir argumentos
--> descreve com precisao um algoritmo
proposicao --> sentenca q e verdadeira ou falsa, nao pode ser ambos
negacao --> sempre inverte o valor logico da proposicao (¬p ou ¯p)
and --> quando ambos sao verdade o resultado e verdadeiro tambem (p ∧ q)
or --> quando pelo menos uma proposicao e verdadeira, o resultado tambem sera (p ∨ q)
exclusive-or --> quando um e verdadeiro e o outro e falso, o resultado sera verdadeiro(p ⊕ q)
@Dpbm
Dpbm / logic.py
Created January 28, 2023 22:14 — forked from primaryobjects/logic.py
Quantum Computing logic gates for XOR, AND, NAND, OR using Qiskit.
from qiskit import qiskit, QuantumCircuit
def execute(func):
print('0 0: {}'.format(func(0, 0)))
print('0 1: {}'.format(func(0, 1)))
print('1 0: {}'.format(func(1, 0)))
print('1 1: {}'.format(func(1, 1)))
def xor(a, b):
"""
@Dpbm
Dpbm / redes.md
Last active January 5, 2023 20:32

Redes

  • sistema de comunicação --> tudo que possibilita a informação sair de uma fonte para um destino

componentes de um sistema de informação

  • mídia de transporte --> meio fisico
  • técnicas de codificação dos sinais --> maneiras de transformar a informação em sinais analógicos para serem transmitidos
  • protocolos de comunicação --> regras de como as mensagens devem ser enviadas, recebidas e interpretadas
  • equipamento de acesso à mídia --> equipamentos encarregados de seguir as etapas do protocolo usado (como um roteador, placa de rede, etc)
@Dpbm
Dpbm / archlinux-virtualbox.sh
Created December 9, 2022 22:17 — forked from GabLeRoux/archlinux-virtualbox.sh
Virtualbox archlinux notes
# sudo /sbin/rcvboxdrv -h
# Unloading modules:
# Loading modules: modprobe: FATAL: Module vboxnetadp not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxnetflt not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxpci not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxdrv not found in directory /lib/modules/4.4.3-1-ARCH
# Solution
# from https://forum.antergos.com/topic/818/can-t-run-my-vitualbox/4
@Dpbm
Dpbm / readme.md
Last active November 28, 2022 17:34

Brincando com o comando DD do linux

/dev/zero

    dd if=/dev/zero of=test.iso bs=1M count=20
    xxd test.iso

    00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
    00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
@Dpbm
Dpbm / tmux.md
Created November 15, 2022 11:57 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@Dpbm
Dpbm / index.html
Last active November 12, 2022 01:25
A BR phone input formatter
<!DOCTYPE html>
<html lang="en">
<head>
<title>phone input formatter</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>