Skip to content

Instantly share code, notes, and snippets.

View apoos-maximus's full-sized avatar
🦋
survive !

APOORV SACHAN apoos-maximus

🦋
survive !
View GitHub Profile
@apoos-maximus
apoos-maximus / atomic_compare_and_exchange.cpp
Last active April 14, 2024 04:28
using this gist in the lockfree queue blog
#include <iostream>
#include <atomic>
int main(){
std::atomic<int> a(23);
int b = 23;
std::cout << a << std::endl;
a.compare_exchange_weak(b, 12);
std::cout << a << std::endl;
return 0;
@apoos-maximus
apoos-maximus / raw_packet_read_write.c
Created March 19, 2024 20:35 — forked from cnlohr/raw_packet_read_write.c
Read/write raw packets in C in Linux
//Based on https://github.com/cnlohr/lamenet/blob/master/librawp.c
#include <stdio.h>
#include <arpa/inet.h>
#include <string.h>
#include <linux/if_packet.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/ether.h>
@apoos-maximus
apoos-maximus / xclip-copy-to-clipboard.md
Created January 15, 2019 18:47 — forked from Brainiarc7/xclip-copy-to-clipboard.md
Using xclip to copy terminal content to the clip board on Linux

Using xclip to copy terminal content to the clip board:

Say you want to pipe shell output to your clipboard on Linux. How would you do it? First, choose the clipboard destination, either the Mouse clip or the system clipboard.

For the mouse clipboard, pipe straight to xclip:

echo 123 | xclip

For the system clip board, pipe to xclip and select clip directly: