This file contains 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
/* | |
* FINF 0.1.5a (21 Jul 2005) https://tia.mat.br/ | |
* | |
* Interpreter for the "finf" (finf is not forth) language | |
* Copyright (C) 2005 L. A. F. Pereira <l@tia.mat.br> | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, version 2. | |
* |
This file contains 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/python | |
# https://www.youtube.com/watch?v=hm5qmqHUudQ | |
def regressao_julia(d, k): | |
# A fórmula enorme, segundo a jornalista: | |
return (d - k*k) // (k+k) | |
def raiz(n): | |
tentativa = n | |
while True: |
This file contains 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/python | |
import sys | |
import time | |
def is_sleeping(pid): | |
with open("/proc/%d/stat" % pid) as stat: | |
state = stat.read().strip().split() | |
return state[2] == 'S' |
This file contains 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/python | |
import subprocess | |
unmappable_funcs = set() | |
out, err = subprocess.Popen(["objdump", "-t", "Build/Kernel/Kernel"], stdout=subprocess.PIPE).communicate() | |
for line in out.splitlines(): | |
line = line.strip() | |
line = line.decode('ascii') |
This file contains 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
/* Maps a page of the request size near the text page that contains | |
* a symbol. Useful for hand-rolled JIT compilers to avoid indirect | |
* calls to symbols in a program on x86-64. (Part of the code here is | |
* a JIT compiler to encode JSON based on a struct descriptor, but it's | |
* not finished yet.) | |
* | |
* Written by L. Pereira <l@tia.mat.br> | |
* | |
* Thanks to Ole André V. Ravnås for the idea to use the NOREPLACE flag | |
* in mmap(), and to Paul Khuong for helping me make it more robust in |
This file contains 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
project lwan { | |
language = c | |
} | |
configure { | |
# If matched, creates a HAVE_SQLITE define in the config file, | |
# and enables a SQLITE feature that can be used for dependency | |
# testing, and, if linking against this library, adds automatically | |
# its CFLAGS and LDFLAGS. | |
pkg_config sqlite3 { |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; |
This file contains 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
/* link with liblwan and google benchmark */ | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <benchmark/benchmark.h> | |
extern "C" { | |
#include <lwan-coro.h> | |
} | |
struct coro *coro; |
This file contains 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 <stdbool.h> | |
struct coro { | |
void *state; | |
}; | |
struct range_coro { | |
struct coro base; | |
int cur, max, step; |
This file contains 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 <alloca.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
struct tmpvar_hook { | |
void *ptr; | |
struct tmpvar_hook *next; | |
}; | |
static void tmpvar_hook_free(struct tmpvar_hook **hook) { |
NewerOlder