Skip to content

Instantly share code, notes, and snippets.

View Cvar1984's full-sized avatar
⚠️
This account is under NSA investigation

Bellatrix Lugosi Cvar1984

⚠️
This account is under NSA investigation
View GitHub Profile
@Cvar1984
Cvar1984 / callback.c
Created August 18, 2023 06:19
callback in C
#include <stdio.h>
void call(void(*ptr)()) {
ptr();
}
void printString()
{
printf("Hello\n");
}
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCZBvzPGCDLur81+X7K/DyvTb9UIHRiSSVrDX7m0sox9aK60SkWKItbGhsdTJcssUhf02KuMmZAAh9ZQ48SCSUNM7sZUzm0wt0EkOdvple7wPW6Linagx0V6MoU5/xkk62+XzVn8OMJpf0YoJyN5WRHe6iMo2wQZe9AnfZLqO+jd73iD3BPrHfCnkoCQ6pl4lgeBBHZaYKsxBU8W3beHTS3zpyleiqp0bSn3k4iYklB6dHLNSgmOICisCx0LO8sv1F2f+2TQYsLO5zBqNEiN8RFX69Ha/Ptjwq/DcF0hZhabV8oIMC7UNHRzdEJLN6jOL12nLE5UNzsw7tRCs+HQIZoEMFWj4Urn5Aiy0SSUAMGW/vKKFOaK9jrd4yvD1bTuKuh5nAgi1MsFmmxzj7jHLkOIl1kJZKTbb8hIxPcc9mgL9KGNiVZlxEHmKyZvGkpnpuGnRE2+6Xw6dc3HTuPQ0Bvp+R6Vs9Ojw1qUd8WNb4fv6bD/DgsR9E90vufWQGfl33t8i/8LRKXYMOj/3aux1up0hhjeOu7DRp2koTjj1MqBu5nt64g2mdutjKOXhSbvQgWTJVG0qWbnOAT4dNnGUGxfL1REpi/D2J2bmsnAjeOHxSrPpMIfN2bFgJKZLVnIOrwl/BIo3DLYnbB28vVedgdumMinnpQgtLTc3LIwfGLiQ== cvar1984@cvar1984.my.id
uint8_t 1byte
uint16_t 2bye
uint32_t 4byte
unsigned int 4byte
uint64_t 8byte
uintptr_t Unsigned integer of size equal to a pointer on 32bit machine 4byte on 64bit machine 8byte
unsigned means no negative number
signed means can hold both
@Cvar1984
Cvar1984 / pointer.c
Last active July 25, 2023 09:57
easy c pointer reminder if you forget
#include <stdio.h>
int main(){
int a = 1;
int *b = &a;
printf("addr of B is %p value of B is %p (which is address of pointer A: %p) so *B will have value of %d\n",&b, b, &a, *b);
return 0;
}
@Cvar1984
Cvar1984 / chains.sh
Last active August 17, 2023 05:11
strict iptables vps firewall configurations for minecraft and website hosting
#!/usr/bin/bash
# NEW state matches a packet creating a new connection or is part of a two-way connection that has not seen packets in both directions.
# ESTABLISHED his state indicates that the packet’s linked to a connection that has seen packets in both directions.
# RELATED state means that the packet’s starting a new connection, but is associated with an existing connection.
# Reset all chains
iptables -F
iptables -X LOGGING
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://xxxxx</loc>
<lastmod>2011-12-06T17:38:21+00:00</lastmod>
<priority>1</priority>
<changefreq>weekly</changefreq>
</url>
</urlset>
[
"/var/log/apache/access.log",
"/var/log/apache/error.log",
"/usr/local/apache/log/error_log",
"/var/log/httpd/access_log",
"/var/log/httpd/access.log",
"/var/log/httpd/error_log",
"/var/log/httpd/_error_log",
"/var/log/httpd/_access_log",
"/etc/httpd/conf/logs/error_log",
@Cvar1984
Cvar1984 / fbn_ecl.php
Created February 17, 2023 05:30
fibonnaci eclipse
<?php
$count = 10;
function f(int $n)
{
$nPrev = 1;
$nCurrent = 1;
for ($x = 0; $x < $n - 1; $x++) {
$nNext = $nPrev + $nCurrent;
$nPrev = $nCurrent;
<?php
header("Content-type: image/png");
$img_width = 800;
$img_height = 600;
$img = imagecreatetruecolor($img_width, $img_height);
@Cvar1984
Cvar1984 / testlua.c
Created July 22, 2022 01:41 — forked from kpmiller/testlua.c
C program to show execution from luaL_loadbuffer, tested with lua 5.3.1
//compiling on OSX 10.11
//export LUA=path/to/lua-5.3.1/src
//cc -I $LUA -L $LUA -l lua -o testlua testlua.c
#include <stdio.h>
#include <string.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
char *luacode =