Skip to content

Instantly share code, notes, and snippets.

🎯
On Point

Roman A. Taycher rtaycher

🎯
On Point
View GitHub Profile
View single_line_short_repl.py
#!/usr/bin/env python
# single line 255 char repl
l={};e=lambda s:exec("import traceback;\ntry:\n try:\n l['_']=eval(s,globals(),l)\n except SyntaxError:\n l['_']=exec(s,globals(),l)\nexcept Exception: traceback.print_exc()") or (l['_'] if l['_']!=None else '');list(print(e(input('>'))) for _ in range(99))
@rtaycher
rtaycher / simple_repl.py
Created Dec 22, 2018
Simple read eval print loop for python
View simple_repl.py
PROMPT = 'INPUT CODE > '
PROMPT_SIMPLE = ' > '
def eval_code(code):
was_expression = True
try:
try:
return eval(code, locals(), globals()), was_expression
except SyntaxError:
try:
@rtaycher
rtaycher / 3.rs
Created Sep 3, 2015
euler problem doesn't compile
View 3.rs
struct Primes{
current: u64,
prev: Vec<u64>
}
impl Primes{
fn new() -> Primes {
Primes { current: 1, prev: Vec::new()}
}
}
@rtaycher
rtaycher / make_range_int_type
Last active Aug 29, 2015
Create Ranged Int Types w/macro
View make_range_int_type
#![feature(macro_rules)]
//tested on:
//rustc 0.10
//host: x86_64-unknown-linux-gnu
use std::to_str::ToStr;
macro_rules! make_range_int_type(
You can’t perform that action at this time.