Skip to content

Instantly share code, notes, and snippets.

View mondaini's full-sized avatar
🌎
Coding Remotely

Filipe Mondaini mondaini

🌎
Coding Remotely
View GitHub Profile
@andrebrait
andrebrait / keychron_linux.md
Last active March 3, 2025 12:07
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

@alukach
alukach / app.yaml
Last active July 24, 2024 13:54
An example Github Actions for Python + Pipenv + Postgres + Pyright
# .github/workflows/app.yaml
name: My Python Project
on: push
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
@biazzotto
biazzotto / validar_renavam.py
Last active February 3, 2017 10:42
Função para validar sequência de dígitos do Renavam
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Função para validar sequência de dígitos do Renavam.
# Adaptado por Fabricio Biazzotto, a partir do original, feito em java:
# http://blog.victorjabur.com/2010/05/28/renavam_veiculos_java
def validar_renavam(renavam):
# Retorna falso caso o valor passado não seja um número inteiro
@tyomo4ka
tyomo4ka / git-aliases.md
Last active September 30, 2024 10:21 — forked from mwhite/git-aliases.md
The Ultimate Git Alias Setup on OS X (brew)

The Ultimate Git Alias Setup on OS X (brew)

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bash_profile
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@tomasinouk
tomasinouk / battery_capacity_nodemcu
Last active August 3, 2016 17:36
Reading battery capacity nodeMCU - lua
id=0
-- represent actually PIN on nodeMCU such as
-- D7 and D5 in this case
-- GND needs to be connected
sda=7 -- GPIO13
scl=5 -- GPIO14
-- initialize i2c, set pin1 as sda, set pin2 as scl
i2c.setup(id,sda,scl,i2c.SLOW)
@pankaj28843
pankaj28843 / Make soffice command of Libreoffice work on Mac OS X.md
Last active February 12, 2025 06:47
Make soffice command of Libreoffice work on Mac OS X

Deprecated Notice

This script, originally created on April 29, 2015, addressed a different behavior of LibreOffice installation on macOS at that time. However, it is now outdated and no longer relevant. Please refer to the latest comments for updated information, as much has changed over the past 8–9 years.


Quick Start

sudo curl https://gist.githubusercontent.com/pankaj28843/3ad78df6290b5ba931c1/raw/soffice.sh > /usr/local/bin/soffice && sudo chmod +x /usr/local/bin/soffice
@pjb3
pjb3 / terminator.sql
Created March 25, 2015 02:14
Kill all queries that have been running for more than a minute in a Postgres datavase
select pg_terminate_backend(pid)
from (
SELECT
pid
FROM pg_stat_activity
WHERE query <> '<insufficient privilege>'
AND state <> 'idle'
AND pid <> pg_backend_pid()
AND query_start < now() - interval '1 minute'
ORDER BY query_start DESC) t;
@drmalex07
drmalex07 / README-create-debian-startup-script.md
Last active September 15, 2024 02:28
An example of how to create a init.d script in Debian, using dependency booting. #debian #init.d #lsb-script #startup-script
@hsiboy
hsiboy / VBOX_E_INVALID_VM_STATE.md
Last active September 29, 2024 21:39
rescue a VM from VBOX_E_INVALID_OBJECT_STATE

Issue

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.