Skip to content

Instantly share code, notes, and snippets.

View pdegama's full-sized avatar
🦇
Gothem...

Parthka pdegama

🦇
Gothem...
View GitHub Profile
@pdegama
pdegama / client.c
Created May 30, 2024 02:26 — forked from Alexey-N-Chernyshov/client.c
Example of client/server with select().
// Simple example of client.
// Client prints received messages to stdout and sends from stdin.
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/select.h>
#include <netinet/in.h>
@pdegama
pdegama / dns.c
Created May 8, 2024 17:33 — forked from fffaraz/dns.c
DNS Query Code in C with linux sockets
//DNS Query Program on Linux
//Author : Silver Moon ([email protected])
//Dated : 29/4/2009
//Header Files
#include<stdio.h> //printf
#include<string.h> //strlen
#include<stdlib.h> //malloc
#include<sys/socket.h> //you know what this is for
#include<arpa/inet.h> //inet_addr , inet_ntoa , ntohs etc
const std = @import("std");
const os = std.os;
const log = std.log;
const time = std.time;
const MAX_EVENT = 5;
const READ_BUFSIZE = 64 * 1024;
const WRITE_BUFSIZE = 64 * 1024;
fn createSignalfd() !os.fd_t {
@pdegama
pdegama / epoll_sample.c
Created March 29, 2024 02:06 — forked from reterVision/epoll_sample.c
A sample program of how epoll works.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/epoll.h>
#include <errno.h>
@pdegama
pdegama / 06.png
Created May 29, 2023 03:21 — forked from mfd/06.png
Gilroy font
06.png
@pdegama
pdegama / golang.md
Created April 15, 2023 03:51 — forked from zulhfreelancer/golang.md
Run all Go files except tests

Run all Go files except tests

$ go run $(ls -1 *.go | grep -v _test.go)

OR

$ go run !(*_test).go
@pdegama
pdegama / list
Created April 10, 2023 11:48
Beautiful Website
https://www.davidebaratta.com/
https://abhishekjha.me/
https://www.display.care/
https://watracz.com/
https://www.cappen.com/2023/
https://numbered.com/
https://useplink.com/en/
https://superherocheesecake.com/
https://www.tcs.com/
https://www.accenture.com/in-en
@pdegama
pdegama / index.html
Created February 27, 2023 05:37 — forked from apparentlymart/index.html
Golang and Terminal.js web terminal
<html>
<head>
<script src="/terminal.js/dist/terminal.js"></script>
<style>
#terminal {
background: #000000;
color: #ffffff;
display: inline-block;
padding: 10px;
}
@pdegama
pdegama / CMakeLists.txt
Created October 28, 2022 09:48 — forked from jirihnidek/CMakeLists.txt
Example of IPv6 TCP client-server application(s) using blocking sockets
# Main CMakeFile.txt
# Minimal version of CMake
cmake_minimum_required (VERSION 2.6)
# Build type
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Debug' as none was specified.")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
@pdegama
pdegama / shell_bind_tcp.asm
Created October 1, 2022 18:37 — forked from geyslan/shell_bind_tcp.asm
Shell Bind TCP in Assembly (Linux/x86) - forlife
; This is a snippet of the original file in https://github.com/geyslan/SLAE/blob/master/1st.assignment/shell_bind_tcp.asm
global _start
section .text
_start:
; syscalls (/usr/include/asm/unistd_32.h)
; socketcall numbers (/usr/include/linux/net.h)