This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Discord Gateway (WebSocket) API client in C (Tested using GCC/MingW) | |
Dependencies: Winsock, OpenSSL 3.0 | |
Copyright (C) 2022 DevGuyAhnaf - All Rights Reserved | |
Note: I'm a beginner in C, so please forgive any mistakes | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************* | |
* | |
* A minimal Forth compiler in C | |
* By Leif Bruder <leifbruder@gmail.com> http://defineanswer42.wordpress.com | |
* Release 2014-04-04 | |
* | |
* Based on Richard W.M. Jones' excellent Jonesforth sources/tutorial | |
* | |
* PUBLIC DOMAIN | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// compile with: gcc -static -o sendfd sendfd.c | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <sys/un.h> | |
#include <strings.h> | |
int send_fd(int sock, int fd){ | |
// This function does the arcane magic for sending | |
// file descriptors over unix domain sockets | |
struct msghdr msg; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## Loopback Filesystem | |
# This script will create and mount a loopback filesystem | |
# Useful if you need to limit director(ies) by size | |
# but only have one volume | |
# This script needs to be run with sudo | |
LO_FILESYSTEM_NAME=my_loopback | |
LO_FILESYSTEM_MB_SIZE=5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// build: | |
// gcc gtk3-entry-keyboard-event.c `pkg-config --cflags gtk+-3.0` `pkg-config | |
// --libs gtk+-3.0` | |
#include <gtk/gtk.h> | |
static gboolean print_keypress(GtkWidget *widget, GdkEventKey *event, | |
gpointer user_data) { | |
printf("keypress: %#06x %#06x\n", event->keyval, event->hardware_keycode); | |
return FALSE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <pthread.h> | |
#include <netinet/in.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
int main(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <time.h> | |
int main() | |
{ | |
time_t seconds = time(NULL);//Unix epoch 00:00:00 UTC on 1 January 1970 | |
if (seconds == -1) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* File : SHA256.c | |
* Description: C implementation of SHA-256 (256-bit Secure Hash Algorithm). | |
* | |
* Author : AugFJTan | |
* Last Modified 18 Feb 2018 06:50 PM | |
*/ | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
/* | |
* The Dan Bernstein popuralized hash.. See | |
* https://github.com/pjps/ndjbdns/blob/master/cdb_hash.c#L26 Due to hash | |
* collisions it seems to be replaced with "siphash" in n-djbdns, see | |
* https://github.com/pjps/ndjbdns/commit/16cb625eccbd68045737729792f09b4945a4b508 | |
*/ | |
uint32_t djb33_hash(const char* s, size_t len) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> // puts and printf | |
#include <string.h> // strlen | |
// delta encoding and decoding on ASCII strings | |
// basically the char type is converted into an int type to allow for addition and subtraction | |
// doing so is basically doing arithmetic on the ASCII codepoints | |
void delta_encode(signed char * buffer, int length) { | |
signed char last = 0; | |
for (int i = 0; i < length; i++) { |
NewerOlder