Skip to content

Instantly share code, notes, and snippets.

View frednora's full-sized avatar
💧
Glitch and Leak

Fred Nora frednora

💧
Glitch and Leak
View GitHub Profile
@frednora
frednora / ANSI.md
Created August 18, 2023 00:12 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@frednora
frednora / ABOUT.md
Created September 10, 2020 20:49 — forked from laobubu/ABOUT.md
A very simple HTTP server in C, for Unix, using fork()

Pico HTTP Server in C

This is a very simple HTTP server for Unix, using fork(). It's very easy to use

How to use

  1. include header httpd.h
  2. write your route method, handling requests.
  3. call serve_forever("12913") to start serving on port 12913
@frednora
frednora / lsniffer.c
Created July 19, 2020 01:18 — forked from fffaraz/lsniffer.c
Packet Sniffer Code in C using Linux Sockets | http://www.binarytides.com/packet-sniffer-code-c-linux/
/*
Packet sniffer using libpcap library
*/
#include<pcap.h>
#include<stdio.h>
#include<stdlib.h> // for exit()
#include<string.h> //for memset
#include<sys/socket.h>
#include<arpa/inet.h> // for inet_ntoa()
@frednora
frednora / rand.c
Created March 17, 2020 20:55 — forked from marcoscastro/rand.c
Exemplo que gera números aleatórios dados os limites superior e inferior.
// Exemplo de geração de números aleatórios
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/*
A função gerar_numero() retorna um número aleatório
que pertence ao intervalo [lim_inf, lim_sup]
@frednora
frednora / update_mouse_ok.c
Created January 23, 2019 13:37
Update Mouse OK
// Credits:
// Omar Mohammad. Maadi, Cairo, Egypt. (Original in Assembly)
// Wagner Teixeira
// Fred Nora
//==================================================================================
// Start - testing update_mouse
//==================================================================================
#define MOUSE_LEFT_BTN 0x01
@frednora
frednora / refresh_rectangle.c
Created January 22, 2019 17:48
Refresh rectangle
void
refresh_rectangle ( unsigned long x,
unsigned long y,
unsigned long width,
unsigned long height )
{
void *p = (void *) FRONTBUFFER_ADDRESS;
const void *q = (const void*) BACKBUFFER_ADDRESS;
//#TEST
@frednora
frednora / CreatePageDirectory
Created November 16, 2018 21:01
CreatePageDirectory
void *CreatePageDirectory (){
int i;
unsigned long destAddressVA; //virtual.
//alocaremos uma página apenas, pois tem 4KB.
destAddressVA = (unsigned long) newPage ();
if ( destAddressVA == 0 )
@frednora
frednora / virt-to-phys
Created September 22, 2018 20:28
virt-to-phys
unsigned long
virtual_to_physical( unsigned long virtual_address,
unsigned long dir_address )
{
unsigned long address;
unsigned long *dir = (unsigned long *) dir_address;
unsigned long tmp;
@frednora
frednora / mouse-support.c
Last active September 11, 2018 01:08
mouse support
// gist para a rotina de mouse.
//
// ************* C *********************
//
//=======================================================
//++ Usadas pelo mouse.
// hardwarelib.inc