Skip to content

Instantly share code, notes, and snippets.

View rtaycher's full-sized avatar
🎯
On Point

Roman A. Taycher rtaycher

🎯
On Point
View GitHub Profile
@rtaycher
rtaycher / single_line_short_repl.py
Created July 1, 2019 09:00
single line 255 char repl
#!/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 December 22, 2018 15:07
Simple read eval print loop for python
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 September 3, 2015 05:25
euler problem doesn't compile
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 August 29, 2015 14:01
Create Ranged Int Types w/macro
#![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(