Skip to content

Instantly share code, notes, and snippets.

@Strus
Strus / clangd.md
Last active May 10, 2024 09:49
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 only way to painlessly generate it is to use CMake.

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.

Method summary

Basically what we need to achieve is to create a CMake file that will generate a compile_commands.json file with information about:

@sebkln
sebkln / RequestMiddlewares.php
Created January 6, 2024 15:48
Middleware for web manifest in TYPO3 v12. Adjusted version of the solution provided by Kevin Appelt in TYPO3 Slack: https://typo3.slack.com/archives/C025BQLFA/p1680299950579649
<?php
return [
'frontend' => [
'yourvendor/webmanifest' => [
'target' => \YourVendor\Sitepackage\Middleware\Webmanifest::class,
'before' => [
'typo3/cms-frontend/page-resolver',
],
'after' => [
@qgy18
qgy18 / index.js
Created March 23, 2024 05:15
update certificate to tencent cdn
const fs = require('fs');
const tencentcloud = require('tencentcloud-sdk-nodejs');
const TENCENTCLOUD_SECRET_ID = 'your secret id';
const TENCENTCLOUD_SECRET_KEY = 'your secret key';
const CERTIFICATE_PUBLIC_KEY_FILE = 'your public cert file';
const CERTIFICATE_PRIVATE_KEY_FILE = 'your private cert file';
const CERTIFICATE_DOMAIN = 'your domain';
@ekollof
ekollof / sshfp.yml
Created January 30, 2020 12:40
ansible playbook getting/registering sshfp records with cloudflare
- name: get SSHFP records
shell: "ssh-keygen -r {{ ansible_nodename }} | awk '{print $4, $5, $6}'"
register: sshfp_entries
- name: Register SSHFP with CloudFlare
cloudflare_dns:
zone: "hackerheaven.org"
record: "{{ ansible_hostname }}"
type: SSHFP
account_email: "{{ cloudflare_email }}"
@odudex
odudex / nostr_seed.py
Last active May 10, 2024 09:43
Uses Embit to convert hex or bech32 keys to BIP39 seed words and vice-versa
"""Uses Embit and qrcode modules to convert hex and bech32 keys to BIP39 seed words and vice-versa.
Also generates ascii compact seed QR codes.
Install Embit:
pip install embit
Exemple: Words as input:
python nostr_c_seed_qr.py picture body actor coil end satoshi fish mom distance proof thank play fantasy friend dinner clump boring ozone review cart virtual toss foot infant
Hex Key: a4431c0a96a4997ed5ec763fb58b7f532530b9cf916219f3d2e2118f47cb56bb
Bech32 key: nsec153p3cz5k5jvha40vwclmtzml2vjnpww0j93pnu7juggc737t26ascxcmgr
BIP39 seed numbers: [1315, 200, 22, 363, 589, 1532, 702, 1143, 510, 1379, 1791, 1331, 665, 744, 499, 355, 208, 1269, 1477, 281, 1956, 1838, 728, 923]
# This supports merging as many adapters as you want.
# python merge_adapters.py --base_model_name_or_path <base_model> --peft_model_paths <adapter1> <adapter2> <adapter3> --output_dir <merged_model>
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
import os
import argparse
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active May 10, 2024 09:38
Online Resources For Web Developers (No Downloading)
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 10, 2024 09:36
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@keuv-grvl
keuv-grvl / pandoc.md2pdf.sublime-build
Last active May 10, 2024 09:35
Convert Markdown to PDF within Sublime Text using Pandoc
{
"cmd": ["pandoc --latex-engine=xelatex --filter=pandoc-citeproc -o '$file_base_name.pdf' '$file_name'"],
"selector": "text.html.markdown",
"shell": true
}
@adhithyan15
adhithyan15 / countdown.js
Last active May 10, 2024 09:35
A simple countdown timer in Javascript
/********************************************************************************************************************
Countdown.js is a simple script to add a countdown timer
for your website. Currently it can only do full minutes
and partial minutes aren't supported. This script is a fork of http://jsfiddle.net/HRrYG/ with some
added extensions. Since the original code that I forked was released under Creative Commons by SA license,
I have to release this code under the same license. You can view a live demo of this code at http://jsfiddle.net/JmrQE/2/.
********************************************************************************************************************/
function countdown(minutes) {
var seconds = 60;
var mins = minutes