Skip to content

Instantly share code, notes, and snippets.

View brccabral's full-sized avatar
🐔
Vamos, Galo! Ganhar o Brasileiro!

Bruno Cabral brccabral

🐔
Vamos, Galo! Ganhar o Brasileiro!
View GitHub Profile

Git Tips

Hook: post-receive

I have a repo on my machine, MyApp, I have a Bare Git Repo on a remote server production at /home/userName/MyApp.
When pushing to remote production, I need to update the code in the actual location /var/www/MyApp, but it needs root/sudo permission.

In the bare repo, add file /home/userName/MyApp/hooks/post-receive. This file is always executed after a push.
The idea is to execute this:

#!/bin/bash
@brccabral
brccabral / 01_README.md
Last active April 16, 2024 21:35
Firefly III
@brccabral
brccabral / 01_README.md
Last active March 26, 2024 02:50
VNC server on Ubuntu Desktop

VNC server on Ubuntu Desktop

Followed these initial instructions
https://www.youtube.com/watch?v=3K1hUwxxYek

The video asks to install lightdm, but there is no need, we can use gdm3.
Install x11vnc.

sudo apt update
@brccabral
brccabral / xgrabkey.c
Created March 20, 2024 23:40
XGrabKey
// Original from https://gist.github.com/jouyouyun/669726de58df8d333666
// Compile: gcc xgrabkey.c `pkg-config --cflags --libs x11` -o xgrabkey
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
int main()
{
@brccabral
brccabral / 01_README.md
Last active April 7, 2024 18:24
Pihole
@brccabral
brccabral / 01_README.md
Last active October 21, 2023 02:33
Screen Capture

Screen Capture

C++

Linux

Get the pixels from X11 display and open the image in OpenCV window. Wayland yet to find out.

apt install libopencv-dev
@brccabral
brccabral / 01_README.md
Last active October 17, 2023 17:18
Keystroke

Keystroke

C++

Linux

Send a keystroke to focused window.
Compile with -lX11 -lXtst

Python

@brccabral
brccabral / webcam_capture.cpp
Last active May 12, 2023 22:24 — forked from mik30s/webcam_capture.cpp
Simple C++ program to capture a webcam frame in Linux
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <linux/ioctl.h>
#include <linux/types.h>
#include <linux/v4l2-common.h>
#include <linux/v4l2-controls.h>
#include <linux/videodev2.h>
#include <fcntl.h>
#include <unistd.h>
@brccabral
brccabral / 01_README.md
Last active September 27, 2023 18:10
Yaru theme

Yaru theme

Build from source

sudo apt install meson sassc pkg-config libglib2.0-dev
cd $HOME