Skip to content

Instantly share code, notes, and snippets.

View rexim's full-sized avatar
📺
https://twitch.tv/tsoding

Alexey Kutepov rexim

📺
https://twitch.tv/tsoding
View GitHub Profile
// cc -w -include time.h -o qlock qlock.c // MIT Copyright (c) Tsoding
char*s="// cc -w -include time.h -o qlock qlock.c // MIT Copyright (c) Tsoding\n"
"char*s=\"?\";x,y,d[8],i,dx;f[]={31599,19812,14479,31207,23524,29411,29679,\n"
"30866,31727,31719,1040};char*so,*si;p(ch){i=x/2/(3+2);dx=x/2%(3+2);if(i<8&&(y-5)\n"
"/2<5&&dx<3&&(f[d[i]]>>((5-(y-5)/2-1)*3+dx))&1)printf(\"\\033[1;41;30m%c\\033[0m\",ch\n"
");else printf(\"%c\",ch);if(ch=='\\n'){y+=1;x=0;}else x+=1;}gd(){time_t t=time(NULL);struct\n"
" tm*tm=localtime(&t);d[0]=tm->tm_hour/10;d[1]=tm->tm_hour%10;d[2]=10;d[3]=tm->tm_min\n"
"/10;d[4]=tm->tm_min%10;d[5]=10;d[6]=tm->tm_sec/10;d[7]=tm->tm_sec%10;}main(){for\n"
"(gd();;printf(\"\\n\\033[%dA\\033[%dD\",y+1,x),sleep(1),gd())for(so=s,x=0,y=0;*so;so++\n"
")if(*so==63)for(si=s;*si;si++)switch(*si){case'\\n':p('\\\\');p('n');p('\"');p('\\n')\n"
x,y,cx,cy,dx,
dy,n,f[8][16]
,b[8][16];main
(){f[0][1]=1;
f[1][2]=1;f[2
][0]=1;f[2][1
]=1;f[2][2]=1
;for(;;){for(cy
=0;cy<8;++cy){
( Copyright 2024 Alexey Kutepov <reximkut@gmail.com> )
( Permission is hereby granted, free of charge, to any person obtaining )
( a copy of this software and associated documentation files (the )
( "Software"), to deal in the Software without restriction, including )
( without limitation the rights to use, copy, modify, merge, publish, )
( distribute, sublicense, and/or sell copies of the Software, and to )
( permit persons to whom the Software is furnished to do so, subject to )
( the following conditions: )
#include <stdio.h>
#include <stdlib.h>
#define da_append(xs, x) \
do { \
if ((xs)->count >= (xs)->capacity) { \
if ((xs)->capacity == 0) (xs)->capacity = 256; \
else (xs)->capacity *= 2; \
(xs)->items = realloc((xs)->items, (xs)->capacity*sizeof(*(xs)->items)); \
} \
open Printf
exception Goto of string
let label (name: string) = ()
let goto (name: string) = raise (Goto name)
let goto_block (blocks: (string * (unit -> unit)) list): unit =
let rec goto_block_impl (name: string option): unit =
try
@rexim
rexim / main.rs
Last active April 3, 2024 19:40
The Most Memory Safe Buffer Overflow in Rust!
// The Most Memory Safe Buffer Overflow in Rust!
//
// Consider all the code below under Public Domain
//
// How to build:
// $ rustc main.rs
//
// Wrong password:
// $ printf "hello\n" | ./main
//
BITS 64
%define SYS_exit 60
%define SYS_read 0
%define SYS_write 1
%define SYS_rt_sigaction 13
%define SYS_rt_sigreturn 15
%define STDIN 0
%define STDOUT 1
%define SIGINT 2
use std::io;
use std::io::Write;
use std::fs::File;
use std::process::Command;
#[derive(Debug, Clone, Copy)]
enum DataType {
Int,
Ptr,
Bool,
// Copyright 2021 Alexey Kutepov <reximkut@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
@rexim
rexim / 0001-Make-it-possible-to-include-files-over-https.patch
Last active April 13, 2024 15:16
TCC patch that enables including files via HTTPS using CURL
From 84c42091cbae3735c52e895221f3f95a87155756 Mon Sep 17 00:00:00 2001
From: rexim <reximkut@gmail.com>
Date: Wed, 30 Jun 2021 20:43:47 +0700
Subject: [PATCH] Make it possible to include files over https
---
Makefile | 2 +-
tcc.c | 5 +++++
tccpp.c | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 49 insertions(+), 1 deletion(-)