Skip to content

Instantly share code, notes, and snippets.

View sanxiyn's full-sized avatar

Seo Sanghyeon sanxiyn

View GitHub Profile
@sanxiyn
sanxiyn / lisp.c
Created August 14, 2010 04:16
Lisp
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,
@sanxiyn
sanxiyn / test.py
Created February 7, 2023 08:34
mypy abs test
class Bar:
def bar(self):
pass
class Foo:
def __abs__(self) -> Bar:
return Bar()
foo = Foo()
afoo = abs(foo)
@sanxiyn
sanxiyn / most-frequent.py
Created December 31, 2020 17:58
BNT162b2
import csv
import python_codon_tables
def read_csv_file(file_path):
with open(file_path) as f:
reader = csv.reader(f)
records = list(reader)
return records
use std::error::Error;
use std::fs;
use argparse::{ArgumentParser, Store};
fn main() -> Result<(), Box<Error>> {
let mut mailbox_name = String::new();
{
let mut parser = ArgumentParser::new();
parser.refer(&mut mailbox_name)
// cargo-deps: reqwest="0.9.9", serde="1.0", serde_derive="1.0"
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)]
struct Ip {
origin: String
}
@sanxiyn
sanxiyn / parser.py
Created July 6, 2011 17:15
Lambda calculus parser
class Lambda(object):
pass
class Var(Lambda):
def __init__(self, var):
self.var = var
def __repr__(self):
return "Var(%r)" % self.var
class Abs(Lambda):
@sanxiyn
sanxiyn / log
Created December 12, 2016 13:02
finding compilers
CC_x86_64-unknown-linux-gnu = "cc"
AR_x86_64-unknown-linux-gnu = "ar"
CXX_x86_64-unknown-linux-gnu = "c++"
running sanity check
collecting channel variables
updating submodules
running: "git" "submodule" "sync"
Synchronizing submodule url for 'src/compiler-rt'
Synchronizing submodule url for 'src/jemalloc'
#![crate_type = "lib"]
#![feature(rustc_private)]
extern crate rustc;
use rustc::mir::repr::{Location, Lvalue, Mir};
use rustc::mir::visit::{LvalueContext, MutVisitor};
use std::marker::PhantomData;
pub struct DefUseAnalysis<'tcx> {
Dump of assembler code for function rustc_trans::back::write::diagnostic_handler:
0x00007ffff576c3b0 <+0>: push %rbp
0x00007ffff576c3b1 <+1>: mov %rsp,%rbp
0x00007ffff576c3b4 <+4>: sub $0x390,%rsp
0x00007ffff576c3bb <+11>: mov %rdi,-0x8(%rbp)
0x00007ffff576c3bf <+15>: mov %rsi,-0x10(%rbp)
0x00007ffff576c3c3 <+19>: lea -0xf8(%rbp),%rdi
0x00007ffff576c3ca <+26>: movb $0x0,-0x239(%rbp)
0x00007ffff576c3d1 <+33>: mov -0x8(%rbp),%rax
0x00007ffff576c3d5 <+37>: mov %rax,-0x18(%rbp)
0x7fffea982fc8: 0x8 0x7fffea983378
0x7fffea982fd8: 0x7fffea983378 0xffffffffffffffff
0x7fffea982fe8: 0xffffffffffffffff 0x0
0x7fffea982ff8: 0x0 0xffffffffffffffff
0x7fffea983008: 0xffffffffffffffff 0x0
0x7fffea983018: 0x0 0x7fffe63acd70
0x7fffea983028: 0x7fffda94f580 0x0
0x7fffea983038: 0x0 0x0
0x7fffea983048: 0x0 0x0
0x7fffea983058: 0x7ffff1b40c2a <str78391> 0x0