Skip to content

Instantly share code, notes, and snippets.

View marcelarie's full-sized avatar
🐢
always learning

Marcel Arie marcelarie

🐢
always learning
View GitHub Profile
@Strus
Strus / clangd.md
Last active November 13, 2024 10:15
How to use clangd C/C++ LSP in any project

How to use clangd C/C++ LSP in any project

tl;dr: If you want to just know the method, skip to How to section

Clangd is a state-of-the-art C/C++ LSP that can be used in every popular text editors like Neovim, Emacs or VS Code. Even CLion uses clangd under the hood. Unfortunately, clangd requires compile_commands.json to work, and the easiest way to painlessly generate it is to use CMake.

For simple projects you can try to use Bear - it will capture compile commands and generate compile_commands.json. Although I could never make it work in big projects with custom or complicated build systems.

But what if I tell you you can quickly hack your way around that, and generate compile_commands.json for any project, no matter how compilcated? I have used that way at work for years, originaly because I used CLion which supported only CMake projects - but now I use that method succesfully with clangd and Neovim.

@baatochan
baatochan / !README.md
Last active July 4, 2024 13:37 — forked from linderd/README.md
Linux (Manjaro [Arch]) on a Thinkpad P14s [T14] Gen2 with Intel

Linux (Manjaro [Arch]) on a Thinkpad P14s [T14] Gen2 with Intel

These are my installation-tricks and notes for running Linux on a 2021 Thinkpad P14s Gen2 with 11th gen Intel Core i7-1185G7. It should also be suitable for the Thinkpad T14 Gen2 with Intel as they are technically the same model.

Additionally you may find more AMD specific tips on the gist I've forked. I decided to keep this gist forked as I have used some of the tips they shared and because they inspired me to create my note in the first place.

Sadly there is no entry in the arch-wiki for Intel specific model, but some of the info from AMD one were useful for me. Other useful sources are mentioned in the document in their respective chapters.

Not everything in this doc may be 100% correct as I'm writing this note after having my PC set up and I might have forgotten some of the stuff. I will update it I ever decide to reinstall the OS on my PC.

@jmatsushita
jmatsushita / README
Last active November 8, 2024 16:52
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
###
### [2023-06-19] UPDATE: Just tried to use my instructions again on a fresh install and it failed in a number of places.
###. Not sure if I'll update this gist (though I realise it seems to still have some traffic), but here's a list of
###. things to watch out for:
### - Check out the `nix-darwin` instructions, as they have changed.
### - There's a home manager gotcha https://github.com/nix-community/home-manager/issues/4026
###
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
@linderd
linderd / README.md
Last active July 11, 2024 01:38 — forked from timlinux/README.md
Linux on Thinkpad P14s Gen2 AMD / T14 Gen2 AMD

Linux (Fedora 35) on a Thinkpad P14s [T14] Gen2 AMD

These are my installation-tricks and notes for running Linux on a 2021 Thinkpad P14s Gen2 with AMD Ryzen 7 5850U. It should also be suitable for the Thinkpad T14 Gen2 AMD as they are technically the same modell.
Meanwhile there is also a good test on youtube and an entry in the arch-wiki, which also comments some points mentioned here.

Detailed specs

Shipped:

@tjdevries
tjdevries / aligned_virt_text.lua
Created November 6, 2020 16:16
Aligned Virt Text Example (not guaranteed to work forever)
vim.lsp.diagnostic.get_virtual_text_chunks_for_line = function(bufnr, line, line_diagnostics)
if #line_diagnostics == 0 then
return nil
end
local line_length = #(vim.api.nvim_buf_get_lines(bufnr, line, line + 1, false)[1] or '')
local get_highlight = vim.lsp.diagnostic._get_severity_highlight_name
-- Create a little more space between virtual text and contents
local virt_texts = {{string.rep(" ", 80 - line_length)}}
@egelev
egelev / connect_bluetooth_headphones.sh
Last active August 28, 2024 11:37
Connect bluetooth headphones on Ubuntu 18.04
#!/usr/bin/env bash
function get_headphones_index() {
echo $(pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}')
}
function get_headphones_mac_address() {
local temp=$(pacmd list-cards | grep bluez_card -C20 | grep 'device.string' | cut -d' ' -f 3)
temp="${temp%\"}"
temp="${temp#\"}"
@bradtraversy
bradtraversy / mongodb_cheat_sheet.md
Last active November 15, 2024 10:00
MongoDB Cheat Sheet

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@joseluisq
joseluisq / stash_dropped.md
Last active August 5, 2024 08:36
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@nickloewen
nickloewen / bret_victor-reading_list.md
Last active November 14, 2024 21:10
Bret Victor’s Reading List

This is a plain-text version of Bret Victor’s reading list. It was requested by hf on Hacker News.


Highly recommended things!

This is my five-star list. These are my favorite things in all the world.

A few of these works have had an extraordinary effect on my life or way of thinking. They get a sixth star. ★

@mloskot
mloskot / cheat-tmux.markdown
Created December 14, 2012 13:11
tmux key bindings cheat shee

$ cheat tmux

Managing tmux sessions

$ tmux      # start tmux server
$ tmux at   # attach running sessions to a terminal
$ tmux ls # list running tmux sessions