Skip to content

Instantly share code, notes, and snippets.

View shtirlic's full-sized avatar
📡

Serg Podtynnyi shtirlic

📡
View GitHub Profile
@andrebrait
andrebrait / keychron_linux.md
Last active April 25, 2024 13:24
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.

@ld100
ld100 / ArchLinuxWSL2.md
Last active April 23, 2024 22:42
Steps for setting up Arch Linux on WSL2

Migrating from Ubuntu on WSL to ArchLinux on WSL2

Obsolete notice

This document was created back in 2020 and might not be actual nowadays. It is not supported anymore, so use thise information at your own risk.

Upgrading to WSL 2

  • Download WSL2 Kernel
  • run wsl --set-default-version 2 in windows command line, so that all future WSL machine will use WSL2.
#define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
@ShvaykaD
ShvaykaD / upgrade-postgresql-service-ubuntu.md
Last active July 3, 2023 22:17 — forked from delameko/upgrade-postgres-9.5-to-9.6.md
Upgrading PostgreSQL service from 9.x or 10.x to 11 version on Ubuntu server

TL;DR

Create a backup:

sudo -Hiu postgres pg_dumpall > mybackup.sql

Install Postgres 11, and then:

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

@rbreaves
rbreaves / macOS keyboard layout for Linux
Last active March 31, 2024 10:35
Universal macOS keyboard layout for Linux - Applies to All Windows and Apple Keyboards
# permanent apple keyboard keyswap
echo "options hid_apple swap_opt_cmd=1" | sudo tee -a /etc/modprobe.d/hid_apple.conf
update-initramfs -u -k all
# Temporary & instant apple keyboard keyswap
echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd
# Windows and Mac keyboards - GUI (Physical Alt is Ctrl, Physical Super is Alt, Physical Ctrl is Super)
setxkbmap -option;setxkbmap -option altwin:ctrl_alt_win
@raspi
raspi / pacman-auto-update.service
Last active December 1, 2023 10:01
Arch Linux Pacman auto download updated packages
# Download new packages but don't install them
# Save in /etc/systemd/system/
[Unit]
Description=Pacman Automatic Download (no install) service
After=network-online.target
[Service]
# Wait time if process hangs
TimeoutStopSec=5m
@hopsoft
hopsoft / db.rake
Last active April 3, 2024 13:13
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@asheeshr
asheeshr / ardprintf.c
Last active January 11, 2024 16:37
A printf function for serial communication from Arduino boards
/*
This code should be pasted within the files where this function is needed.
This function will not create any code conflicts.
The function call is similar to printf: ardprintf("Test %d %s", 25, "string");
To print the '%' character, use '%%'
This code was first posted on http://arduino.stackexchange.com/a/201
*/