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
@rometsch
rometsch / i3autolock.md
Last active April 14, 2024 16:52
Configure lockscreen for i3 window manager.

The i3-wm does not come with a keybinding to lock the screen or a preconfigured auto lockscreen. This gist describes how to setup both using i3lock and xautolock. i3lock is a minimalistic lockscreen and xautolock monitors mouse and keyboard activities to automatically lock the screen after a certain time of beiing inactive.

First get the tools if neccessary. E.g. sudo apt install i3lock xautolock.

To setup the keybinding Ctrl+Alt+l (last one is a lowercase L) to lock the screen append the following lines to the i3 configuration file located at ~/.config/i3/config.

# keybinding to lock screen
@loretoparisi
loretoparisi / ffmpeg_frames.sh
Last active April 19, 2024 05:17
Extract all frames from a movie using ffmpeg
# Output a single frame from the video into an image file:
ffmpeg -i input.mov -ss 00:00:14.435 -vframes 1 out.png
# Output one image every second, named out1.png, out2.png, out3.png, etc.
# The %01d dictates that the ordinal number of each output image will be formatted using 1 digits.
ffmpeg -i input.mov -vf fps=1 out%d.png
# Output one image every minute, named out001.jpg, out002.jpg, out003.jpg, etc.
# The %02d dictates that the ordinal number of each output image will be formatted using 2 digits.
ffmpeg -i input.mov -vf fps=1/60 out%02d.jpg
@timsueberkrueb
timsueberkrueb / build-pyside2-ubuntu.md
Last active November 15, 2023 16:11
Building PySide2 on Ubuntu

Tested on Ubuntu 16.10

Clone the pyside-setup repository and init submodules

git clone https://code.qt.io/pyside/pyside-setup.git
cd pyside-setup
git submodule update --init --recursive
@wojteklu
wojteklu / clean_code.md
Last active June 6, 2024 17:35
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@GabLeRoux
GabLeRoux / archlinux-virtualbox.sh
Last active November 27, 2023 12:22
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
@e7d
e7d / sample.sh
Last active May 11, 2024 13:46
Bash "try catch"
#!/bin/bash
export AnException=100
export AnotherException=101
# start with a try
try
( # open a subshell !!!
echo "do something"
[ someErrorCondition ] && throw $AnException
@aravindet
aravindet / jsoncat.md
Last active February 16, 2024 13:08
PostgreSQL JSON Concatenation Operator

Postgres lacks convenient operators for modifying JSON or JSONB values. A common operation one might want to do is to change one property in a JSON column across multiple rows, like:

UPDATE example SET json_col = json_col || '{ "prop": true }'::jsonb WHERE <conditions>;

The || operator is the natural choice for this because it is also used for array and jstore concatenation in Postgres.

This short PLV8 function adds the JSON concatenation operator. It is significantly more powerful than the array and hstore counterparts, and are capable of:

@nerdalert
nerdalert / vim-cheatsheet.md
Last active November 8, 2023 23:38
VIM Cheatsheet

VIM Cheatsheet

Cursor movement

h - move cursor left
j - move cursor down
k - move cursor up
l - move cursor right

w - jump forwards to the start of a word

@roachhd
roachhd / README.md
Last active June 3, 2024 11:26
Basics of BrainFuck

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

BrainFuck Programming Tutorial by: Katie

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

INTRODUCTION

@fegemo
fegemo / hw-glut.c
Last active July 30, 2023 22:06
Um Hello World em OpenGL usando C e GLUT.
#include <GL/freeglut.h>
void desenhaMinhaCena(void)
{
glClearColor(1, 1, 1, 1);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(-0.5, -0.5, 0.0);
glVertex3f( 0.5, -0.5, 0.0);
glVertex3f( 0.5, 0.5, 0.0);