Skip to content

Instantly share code, notes, and snippets.

View khozaei's full-sized avatar

amin khozaei khozaei

View GitHub Profile
@khozaei
khozaei / cclsconfig.lua
Last active December 11, 2022 08:00
nvim config for c
-- .config/nvim/lua/cclsconfig.lua
require('ccls').setup({
lsp = {
use_defaults = true,
codelens = {
enable = true,
events = {"BufWritePost", "InsertLeave"}
}
}
})
@codref
codref / go-ssh-reverse-tunnel.go
Last active August 12, 2024 16:54
Go SSH reverse tunnel implementation (SSH -R)
/*
Go-Language implementation of an SSH Reverse Tunnel, the equivalent of below SSH command:
ssh -R 8080:127.0.0.1:8080 operatore@146.148.22.123
which opens a tunnel between the two endpoints and permit to exchange information on this direction:
server:8080 -----> client:8080
@karthick18
karthick18 / splice.c
Created September 22, 2011 06:31
An example copy of a file to output file using the splice syscall that avoids copying to/from user space buffers to kernel space by employing pipe buffers allocated in kernel space for fast data transfers between 2 files
/*
* An example using splice syscall which avoids copying to/from user space buffers to kernel space
* and uses the pipe buffers allocated in kernel space as an intermediate to directly xfer from one file to another
*
* gcc -o splice splice.c -g
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>