This file contains hidden or 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 <stdlib.h> | |
#include <stdio.h> | |
#include <math.h> | |
#define BOUND 2000000000 | |
int primes_count = 0; | |
int primes[5000] = {0}; | |
char is_composites[45000] = {0}; // > sqrt(2e9) |
This file contains hidden or 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 <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
#define TOKENS "><+-.,[]" | |
#define CODE_SEGMENT_SIZE 30000 | |
#define STACK_SEGMENT_SIZE 1000 | |
#define DATA_SEGMENT_SIZE 30000 | |
#define ERROR_CODE_MISSING_FILE 1 |
This file contains hidden or 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 <string.h> | |
#include <stdlib.h> | |
#include <llvm-c/Core.h> | |
#include <llvm-c/Target.h> | |
#include <llvm-c/TargetMachine.h> | |
#define FALSE 0 | |
#define TRUE 1 |
This file contains hidden or 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
; Translate "Hello world of brainfuck" to LLVM IR manually. | |
; ++++++++++ | |
; [>+++++++>++++++++++>+++>+<<<<-] | |
; >++.>+.+++++++..+++.>++.<<+++++++++++++++. | |
; >.+++.------.--------.>+.>. | |
; ModuleID = 'helloworld.bf' | |
source_filename = "helloworld.bf" | |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-pc-linux-gnu" |
This file contains hidden or 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
% 知识库 | |
%% 性别的实体 | |
female(ann). | |
female(eve). | |
%% 父母的实体 | |
parent(ann, mary). | |
parent(tom, eve). | |
parent(tom, mary). |
This file contains hidden or 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/env fish | |
function perror --description '显示信息到错误输出' | |
if test (count $argv) -gt 0 | |
printf -- $argv >&2 | |
end | |
echo >&2 | |
end | |
function raise --description '抛出异常消息并退出' |
This file contains hidden or 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
#!/bin/sh | |
if [ $# -eq 0 ]; then | |
echo "usage: $0 <c-source-file>" >&2 | |
exit -1 | |
fi | |
input=$(cat <<EOF | |
William 35 25000 | |
Kishore 41 35000 | |
Wallace 37 30000 | |
Bruce 39 29999 |
This file contains hidden or 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/env python3 | |
# -- 非线程安全 -- | |
from matplotlib.font_manager import FontProperties | |
from operator import itemgetter | |
from itertools import groupby | |
import matplotlib.pyplot as canvas | |
import numpy as np |
This file contains hidden or 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/env python | |
import BaseHTTPServer | |
import cgi | |
import mimetypes | |
import os | |
import posixpath | |
import shutil | |
if not mimetypes.inited: |
This file contains hidden or 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
create table spoils ( | |
id int primary key, | |
amount int | |
); | |
comment on table spoils is '分赃表'; | |
comment on column spoils.id is '海盗编号'; | |
comment on column spoils.amount is '可获得的最高金额,null代表死亡'; | |
create or replace function divide(amount_total int, pirate_count int) | |
returns setof spoils as $$ |
NewerOlder