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> | |
struct Rule { | |
int state; | |
int read; | |
int write; | |
int next; | |
char direction; | |
}; |
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
use anyhow::Result; | |
#[derive(Debug)] | |
struct Tag; | |
#[derive(Debug)] | |
struct Launched; | |
#[derive(Debug)] | |
struct Rocket<Stage = Tag> { | |
color: &'static str, | |
speed: i32, |
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 <sys/epoll.h> | |
#include <sys/socket.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <errno.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
#include <string.h> | |
#include <stdlib.h> |
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
data Term a = Value Int a | Add (Term a) (Term a) | Mul (Term a) (Term a) | |
-- deriving (Show) | |
(.+) :: Term a -> Term a -> Term a | |
(.+) a b = Add a b | |
(.*) :: (Num a) => Term a -> Term a -> Term a | |
(.*) a b = Mul a b |
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
const REPEAT: usize = 10; | |
const N: usize = 1024 * 16; | |
fn main() { | |
let mut array = vec![0; N * N]; | |
let mut row = 0.; | |
let mut column = 0.; | |
for _ in 0..REPEAT { |
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
package main | |
import ( | |
"image" | |
"image/color" | |
"image/png" | |
"log" | |
"os" | |
// "fmt" | |
// "strings" |
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 <stddef.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#define MIN(a, b) ((a) < (b) ? (a) : (b)) | |
#define MAX(a, b) ((a) < (b) ? (b) : (a)) | |
typedef unsigned char byte; |
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
# echo "What's your name? " | |
# var name: string = readLine(stdin) | |
# echo "Hi, ", name, "!" | |
from pixie import newImage, writeFile, `[]=`, color | |
from math import pow | |
from std/times import cpuTime | |
proc f(i: var int) = | |
i = i * 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
use geos::Geom; | |
use anyhow::{Context, Result}; | |
use std::io::Write; | |
fn main() { | |
fn try_it() -> Result<()> { | |
let gg1 = geos::Geometry::new_from_wkt("POLYGON ((0 0, 0 5, 6 6, 6 0, 0 0))")?; | |
let gg2 = geos::Geometry::new_from_wkt("POLYGON (((1 1, 1 3, 5 5, 5 1, 1 1))") | |
.with_context(|| format!("Failed to parse WKT"))?; |
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
// g++ thread_pool.cpp -lpthread -othread_pool | |
#include <thread> | |
#include <mutex> | |
#include <condition_variable> | |
#include <vector> | |
#include <functional> | |
#include <memory> | |
#include <iostream> | |
#include <sstream> |
NewerOlder